]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
rcon2irc: add an option irc_commands
authorRudolf Polzer <divverent@alientrap.org>
Tue, 27 Dec 2011 12:54:03 +0000 (13:54 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 27 Dec 2011 12:54:03 +0000 (13:54 +0100)
server/rcon2irc/rcon2irc-example.conf
server/rcon2irc/rcon2irc.pl

index 2e031cdb1878bba8c7cb79d23f269f9bc86fe790..7a5379913537e86401063a3daeb5286c827da8eb 100644 (file)
@@ -21,6 +21,9 @@ irc_channel = #Xonotic-Pwayers
 # Users with a Q account listed here can use admin commands on the bot
 #irc_quakenet_authusers = a b c
 
 # Users with a Q account listed here can use admin commands on the bot
 #irc_quakenet_authusers = a b c
 
+# IRC on-connect commands
+#irc_commands = PRIVMSG Admin :hello, I am there; MODE $nick +x
+
 # Extra plug-ins to load
 #plugins =
 
 # Extra plug-ins to load
 #plugins =
 
index ecc8d5aaa83e0c4a02a1158d55828aea338be0fe..cb800e84a2876e3c0e19678343c448e5eaa4f7b5 100755 (executable)
@@ -759,6 +759,7 @@ our %config = (
        irc_admin_quote_re => "",
 
        irc_reconnect_delay => 300,
        irc_admin_quote_re => "",
 
        irc_reconnect_delay => 300,
+       irc_commands => "",
 
        plugins => "",
 );
 
        plugins => "",
 );
@@ -1062,10 +1063,17 @@ sub irc_joinstage($)
                        # we get here again when Q asks us
                }
        }
                        # we get here again when Q asks us
                }
        }
+
+       for(split / *; */, $store{irc_commands})
+       {
+               s/\$nick/$store{irc_nick}/g;
+               out irc => 1, $_;
+       }
        
        # if we get here, we are on IRC
        $store{irc_joined_channel} = 1;
        schedule sub {
        
        # if we get here, we are on IRC
        $store{irc_joined_channel} = 1;
        schedule sub {
+               # wait 1 sec to let stuff calm down
                out irc => 1, "JOIN $config{irc_channel}";
        } => 1;
        return 0;
                out irc => 1, "JOIN $config{irc_channel}";
        } => 1;
        return 0;
@@ -1379,7 +1387,10 @@ sub cond($)
 
                if ($nick eq $store{irc_nick}) {
                        $store{irc_maxlen} = 510 - length($hostmask);
 
                if ($nick eq $store{irc_nick}) {
                        $store{irc_maxlen} = 510 - length($hostmask);
-                       $store{irc_joined_channel} = 1;
+                       if($store{irc_joined_channel} == 1)
+                       {
+                               $store{irc_joined_channel} = 2;
+                       }
                        print "* detected maximum line length for channel messages: $store{irc_maxlen}\n";
                }
 
                        print "* detected maximum line length for channel messages: $store{irc_maxlen}\n";
                }