1
0
mirror of https://github.com/minetest-mods/irc.git synced 2024-12-27 01:10:17 +01:00

Add "reconnect" time variable to config. (#23)

Allow server admin to specify how long until a reconnect occurs after a timeout (default 600 seconds) without having to modify the core code.
This commit is contained in:
Robbie Ferguson 2016-05-18 18:03:34 -04:00 committed by Auke Kok
parent 464f2febee
commit 03edbd29ed
2 changed files with 3 additions and 1 deletions

View File

@ -44,6 +44,7 @@ setting("bool", "send_join_part", true) -- Whether to send player join and par
setting("string", "password") -- Server password
setting("bool", "secure", false) -- Enable a TLS connection, requires LuaSEC
setting("number", "timeout", 60) -- Underlying socket timeout in seconds.
setting("number", "reconnect", 600) -- Reconnect in seconds after timeout.
setting("string", "command_prefix") -- Prefix to use for bot commands
setting("bool", "debug", false) -- Enable debug output
setting("bool", "enable_player_part", true) -- Whether to enable players joining and parting the channel

View File

@ -107,6 +107,7 @@ function irc:connect()
port = self.config.port,
password = self.config.password,
timeout = self.config.timeout,
reconnect = self.config.reconnect,
secure = self.config.secure
})
end)
@ -114,7 +115,7 @@ function irc:connect()
if not good then
minetest.log("error", ("IRC: Connection error: %s: %s -- Reconnecting in ten minutes...")
:format(self.config.server, message))
minetest.after(600, function() self:connect() end)
minetest.after(self.config.reconnect, function() self:connect() end)
return
end