Fix issue with previous commit.

Mea culpa. It was possible an error caused `require` to
not be reset, causing possible errors in the future.
This commit is contained in:
Diego Martínez 2016-12-03 03:13:48 -03:00
parent 9f8b4fd4af
commit 0c8538bfb8

View File

@ -110,11 +110,13 @@ function irc:connect()
realname = "Minetest",
})
self:doHook(self.conn)
-- We need to swap the `require` function again since
-- LuaIRC `require`s `ssl` if `irc.secure` is true.
local old_require = require
require = ie.require
local good, message = pcall(function()
-- We need to swap the `require` function again since
-- LuaIRC `require`s `ssl` if `irc.secure` is true.
local old_require = require
require = ie.require
self.conn:connect({
host = self.config.server,
port = self.config.port,
@ -123,9 +125,10 @@ function irc:connect()
reconnect = self.config.reconnect,
secure = self.config.secure
})
require = old_require
end)
require = old_require
if not good then
minetest.log("error", ("IRC: Connection error: %s: %s -- Reconnecting in %d seconds...")
:format(self.config.server, message, self.config.reconnect))