]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - server/rcon2irc/rcon2irc.pl
Merge branch 'master' of git://de.git.xonotic.org/xonotic/xonotic
[xonotic/xonotic.git] / server / rcon2irc / rcon2irc.pl
index ecc8d5aaa83e0c4a02a1158d55828aea338be0fe..49d424c3acb3058d41eac645de95fe2b956141c4 100755 (executable)
@@ -752,6 +752,7 @@ our %config = (
        dp_server_from_wan => "",
        dp_listen_from_server => "", 
        dp_utf8_enable => $color_utf8_enable,
+       dp_timinglog => "",
        irc_local => "",
 
        irc_admin_password => "",
@@ -759,6 +760,7 @@ our %config = (
        irc_admin_quote_re => "",
 
        irc_reconnect_delay => 300,
+       irc_commands => "",
 
        plugins => "",
 );
@@ -918,7 +920,7 @@ sub irc_error()
                $store{irc_nick} = "";
                schedule sub {
                        my ($timer) = @_;
-                       out dp => 0, 'sv_cmd bans', 'status 1', 'log_dest_udp';
+                       out dp => 0, 'sv_cmd banlist', 'status 1', 'log_dest_udp';
                        $store{status_waiting} = -1;
                } => 1;
                # this will clear irc_error_active
@@ -1062,10 +1064,17 @@ sub irc_joinstage($)
                        # 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 {
+               # wait 1 sec to let stuff calm down
                out irc => 1, "JOIN $config{irc_channel}";
        } => 1;
        return 0;
@@ -1379,7 +1388,10 @@ sub cond($)
 
                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";
                }
 
@@ -1717,6 +1729,15 @@ sub cond($)
                my ($all, $cpu, $lost, $avg, $max, $sdev) = @_;
                return 0 # don't complain when just on the voting screen
                        if !$store{playing};
+               if(length $config{dp_timinglog})
+               {
+                       open my $fh, '>>', $config{dp_timinglog}
+                               or warn "open >> $config{dp_timinglog}: $!";
+                       print $fh "@{[time]} $cpu $lost $avg $max $sdev $store{slots_active}\n"
+                               or warn "print >> $config{dp_timinglog}: $!";
+                       close $fh
+                               or warn "close >> $config{dp_timinglog}: $!";
+               }
                return 0 # don't complain if it was less than 0.5%
                        if $lost < 0.5;
                return 0 # don't complain if nobody is looking
@@ -1764,7 +1785,7 @@ out dp => 0, 'echo "Unknown command \"rcon2irc_eval\""'; # assume the server has
 # not containing our own IP:port, or by rcon2irc_eval not being a defined command).
 schedule sub {
        my ($timer) = @_;
-       out dp => 0, 'sv_cmd bans', 'status 1', 'log_dest_udp', 'rcon2irc_eval set dummy 1';
+       out dp => 0, 'sv_cmd banlist', 'status 1', 'log_dest_udp', 'rcon2irc_eval set dummy 1';
        $store{status_waiting} = -1;
        schedule $timer => (exists $store{dp_hostname} ? $config{dp_status_delay} : 1);;
 } => 1;