mirror of
https://github.com/minetest-mods/irc.git
synced 2024-12-27 17:20:20 +01:00
Added auto-reconnect on ping timeout
This commit is contained in:
parent
10afaf5783
commit
7caf0dc25f
@ -183,8 +183,6 @@ I'd like to thank the users who supported this mod both on the Minetest
|
||||
|
||||
LICENSE
|
||||
-------
|
||||
This license applies only to the `init.lua' and `config.lua' files.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
|
2
etc/quickinst.sh
Executable file
2
etc/quickinst.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#! /bin/sh
|
||||
(cd Build && cmake . && make && make pack_mod && rm -fr ~/.minetest/games/testing/mods/irc && cp -fr irc ~/.minetest/games/testing/mods/ )
|
@ -1,7 +1,21 @@
|
||||
|
||||
-- IRC Mod for Minetest
|
||||
-- By Diego Martínez <kaeza@users.sf.net>
|
||||
--
|
||||
-- This mod allows to tie a Minetest server to an IRC channel.
|
||||
--
|
||||
-- This program is free software. It comes without any warranty, to
|
||||
-- the extent permitted by applicable law. You can redistribute it
|
||||
-- and/or modify it under the terms of the Do What The Fuck You Want
|
||||
-- To Public License, Version 2, as published by Sam Hocevar. See
|
||||
-- http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
--
|
||||
|
||||
local irc = require("irc");
|
||||
|
||||
minetest.register_on_joinplayer(function ( player )
|
||||
|
||||
irc.say(mt_irc.channel, "*** "..player:get_player_name().." joined the game");
|
||||
mt_irc.say(mt_irc.channel, "*** "..player:get_player_name().." joined the game");
|
||||
mt_irc.connected_players[player:get_player_name()] = mt_irc.auto_join;
|
||||
|
||||
end);
|
||||
@ -39,7 +53,7 @@ local function bot_command ( from, message )
|
||||
end
|
||||
|
||||
if (not mt_irc.bot_commands[cmd]) then
|
||||
irc.say(from, "Unknown command `"..cmd.."'. Try `!help'.");
|
||||
mt_irc.say(from, "Unknown command `"..cmd.."'. Try `!help'.");
|
||||
return;
|
||||
end
|
||||
|
||||
@ -80,14 +94,11 @@ irc.register_callback("private_msg", function ( from, message )
|
||||
end);
|
||||
|
||||
irc.register_callback("kick", function ( chaninfo, to, from )
|
||||
if (mt_irc.connect_ok) then
|
||||
mt_irc.connect_ok = false;
|
||||
minetest.chat_send_all("IRC: Bot was kicked by "..from..". Reconnecting bot in 5 seconds...");
|
||||
mt_irc.got_motd = true;
|
||||
mt_irc.connect_ok = false;
|
||||
irc.quit("Kicked");
|
||||
minetest.after(5, mt_irc.connect);
|
||||
end
|
||||
minetest.chat_send_all("IRC: Bot was kicked by "..from..". Reconnecting bot in 5 seconds...");
|
||||
mt_irc.got_motd = false;
|
||||
mt_irc.connect_ok = false;
|
||||
irc.quit("Kicked");
|
||||
minetest.after(5, mt_irc.connect);
|
||||
end);
|
||||
|
||||
irc.register_callback("nick_change", function ( from, old_nick )
|
||||
@ -123,3 +134,11 @@ minetest.register_on_shutdown(function ( )
|
||||
irc.poll();
|
||||
end
|
||||
end);
|
||||
|
||||
irc.handlers.on_error = function (from, respond_to)
|
||||
minetest.chat_send_all("IRC: Ping timeout. Reconnecting bot in 5 seconds...");
|
||||
mt_irc.got_motd = false;
|
||||
mt_irc.connect_ok = false;
|
||||
irc.quit("Ping timeout");
|
||||
minetest.after(5, mt_irc.connect);
|
||||
end
|
||||
|
@ -1,4 +1,18 @@
|
||||
|
||||
-- IRC Mod for Minetest
|
||||
-- By Diego Martínez <kaeza@users.sf.net>
|
||||
--
|
||||
-- This mod allows to tie a Minetest server to an IRC channel.
|
||||
--
|
||||
-- This program is free software. It comes without any warranty, to
|
||||
-- the extent permitted by applicable law. You can redistribute it
|
||||
-- and/or modify it under the terms of the Do What The Fuck You Want
|
||||
-- To Public License, Version 2, as published by Sam Hocevar. See
|
||||
-- http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
--
|
||||
|
||||
local irc = require("irc");
|
||||
|
||||
minetest.register_chatcommand("msg", {
|
||||
params = "<name> <message>";
|
||||
description = "Send a private message to an IRC user";
|
||||
|
@ -1,3 +1,16 @@
|
||||
|
||||
-- IRC Mod for Minetest
|
||||
-- By Diego Martínez <kaeza@users.sf.net>
|
||||
--
|
||||
-- This mod allows to tie a Minetest server to an IRC channel.
|
||||
--
|
||||
-- This program is free software. It comes without any warranty, to
|
||||
-- the extent permitted by applicable law. You can redistribute it
|
||||
-- and/or modify it under the terms of the Do What The Fuck You Want
|
||||
-- To Public License, Version 2, as published by Sam Hocevar. See
|
||||
-- http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
--
|
||||
|
||||
-- *************************
|
||||
-- ** BASIC USER SETTINGS **
|
||||
-- *************************
|
||||
@ -8,7 +21,7 @@ mt_irc.server = nil;
|
||||
-- Port to connect on joinplayer (number, default 6667)
|
||||
mt_irc.port = nil;
|
||||
|
||||
-- Channel to connect on joinplayer (string, default "#minetest-irc-testing")
|
||||
-- Channel to connect on joinplayer (string, default "##mt-irc-mod")
|
||||
mt_irc.channel = nil;
|
||||
|
||||
-- ***********************
|
||||
@ -23,7 +36,7 @@ mt_irc.timeout = nil;
|
||||
|
||||
-- Nickname when using single conection (string, default "minetest-"..<server-id>);
|
||||
-- (<server-id> is the server IP address packed as a 32 bit integer).
|
||||
mt_irc.server_nick = nil;
|
||||
mt_irc.server_nick = "HelloIRC";
|
||||
|
||||
-- Password to use when using single connection (string, default "")
|
||||
mt_irc.password = nil;
|
||||
|
@ -1,4 +1,16 @@
|
||||
|
||||
-- IRC Mod for Minetest
|
||||
-- By Diego Martínez <kaeza@users.sf.net>
|
||||
--
|
||||
-- This mod allows to tie a Minetest server to an IRC channel.
|
||||
--
|
||||
-- This program is free software. It comes without any warranty, to
|
||||
-- the extent permitted by applicable law. You can redistribute it
|
||||
-- and/or modify it under the terms of the Do What The Fuck You Want
|
||||
-- To Public License, Version 2, as published by Sam Hocevar. See
|
||||
-- http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
--
|
||||
|
||||
-- TODO
|
||||
|
||||
--[[
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
-- IRC Mod for Minetest
|
||||
-- (C) 2012 Diego Martínez <kaeza@users.sf.net>
|
||||
-- By Diego Martínez <kaeza@users.sf.net>
|
||||
--
|
||||
-- This mod allows to tie a Minetest server to an IRC channel.
|
||||
--
|
||||
@ -142,7 +143,7 @@ mt_irc.say = function ( to, msg )
|
||||
irc.say(to, msg);
|
||||
end
|
||||
|
||||
mt_irc._irc = irc;
|
||||
mt_irc.irc = irc;
|
||||
|
||||
dofile(MODPATH.."/callback.lua");
|
||||
dofile(MODPATH.."/chatcmds.lua");
|
||||
|
@ -43,11 +43,11 @@ local icallbacks = {
|
||||
ctcp_version = {},
|
||||
}
|
||||
local requestinfo = {whois = {}}
|
||||
local handlers = {}
|
||||
local ctcp_handlers = {}
|
||||
local user_handlers = {}
|
||||
local serverinfo = {}
|
||||
local ip = nil
|
||||
handlers = {}
|
||||
ctcp_handlers = {}
|
||||
user_handlers = {}
|
||||
serverinfo = {}
|
||||
ip = nil
|
||||
-- }}}
|
||||
|
||||
-- defaults {{{
|
||||
|
Loading…
Reference in New Issue
Block a user