]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
merge two join triggers; use nick from store instead of config
authorMrBougo <mrbougo@xonotic.org>
Tue, 7 Sep 2010 14:55:25 +0000 (16:55 +0200)
committerMrBougo <mrbougo@xonotic.org>
Tue, 7 Sep 2010 14:55:25 +0000 (16:55 +0200)
The second one had a slightly wrong regex, and didn't get a match anyway because of the previous one returning before.

server/rcon2irc/rcon2irc.pl

index a29a0a1571f9d80245ae571b1e1e95926777b51e..b5d3c89e859405277dbfec3c27d9d60cf4e6e3b4 100755 (executable)
@@ -1321,12 +1321,20 @@ sub cond($)
                return irc_joinstage(0);
        } ],
        
                return irc_joinstage(0);
        } ],
        
-       # Catch joins of people in a channel the bot is in and catch our own joins of a channel
+       # Catch joins of people in a channel the bot is in and catch our own joins of a channel,
+       # detect channel join message and note hostname length to get the maximum allowed line length
        [ irc => q{:(([^! ]*)![^ ]*) JOIN (#.+)} => sub {
                my ($hostmask, $nick, $chan) = @_;
        [ irc => q{:(([^! ]*)![^ ]*) JOIN (#.+)} => sub {
                my ($hostmask, $nick, $chan) = @_;
+
+               if ($nick eq $store{irc_nick}) {
+                       $store{irc_maxlen} = 510 - length($hostmask);
+                       $store{irc_joined_channel} = 1;
+                       print "* detected maximum line length for channel messages: $store{irc_maxlen}\n";
+               }
+
                return 0 unless ($store{irc_quakenet_users});
                
                return 0 unless ($store{irc_quakenet_users});
                
-               if ($nick eq $config{irc_nick}) {
+               if ($nick eq $store{irc_nick}) {
                        out irc => 0, "PRIVMSG Q :users $chan"; # get auths for all users
                } else {
                        $store{quakenet_hosts}->{$nick} = $hostmask;
                        out irc => 0, "PRIVMSG Q :users $chan"; # get auths for all users
                } else {
                        $store{quakenet_hosts}->{$nick} = $hostmask;
@@ -1395,14 +1403,6 @@ sub cond($)
                return 0;
        } ],
 
                return 0;
        } ],
 
-       # detect channel join message and note hostname length to get the maximum allowed line length
-       [ irc => q{(:(?i:(??{$store{irc_nick}}))![^ ]* )(?i:JOIN) :(?i:(??{$config{irc_channel}}))} => sub {
-               $store{irc_maxlen} = 510 - length($1);
-               $store{irc_joined_channel} = 1;
-               print "* detected maximum line length for channel messages: $store{irc_maxlen}\n";
-               return 0;
-       } ],
-
        # chat: Xonotic server -> IRC channel
        [ dp => q{\001(.*?)\^7: (.*)} => sub {
                my ($nick, $message) = map { color_dp2irc $_ } @_;
        # chat: Xonotic server -> IRC channel
        [ dp => q{\001(.*?)\^7: (.*)} => sub {
                my ($nick, $message) = map { color_dp2irc $_ } @_;