]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
(quakequit) use signal_add_first for 'message_irc_mode'. Add option to toggle debug...
authorphyber <redacted>
Fri, 6 Mar 2009 08:18:34 +0000 (08:18 +0000)
committerbw1 <redacted>
Sun, 14 Jan 2018 21:00:15 +0000 (22:00 +0100)
scripts/quakequit.pl

index 1f8bf2332d1b3501171bb17ceefd646f4a9608de..7840a135dcb05297090f825c969215f831b01589 100644 (file)
@@ -10,7 +10,9 @@ $VERSION = "1.0";
        licence         => "GPLv2",
        changed         => "02/03/2009",
 );
-
+# Output a few extra messages to the status window to help with 
+# any errors that might happen.
+my $debug = 0;
 # Hash to store our temporary ignores in.
 my %quits;
 
@@ -42,7 +44,7 @@ sub message_join {
        if (process_tag($tag) == 0) {
                return 0;
        }
-       #Irssi::print "Processing JOIN $tag: $nick $addr";
+       Irssi::print "Processing JOIN $tag: $nick $addr" if $debug;
        # If the joining nick is in our quit hash, don't show the join.
        if ($quits{$nick} == 1) {
                Irssi::signal_stop();
@@ -58,7 +60,7 @@ sub message_quit {
        if (process_tag($tag) == 0) {
                return 0;
        }
-       #Irssi::print "Processing QUIT $tag: $nick $addr $reason";
+       Irssi::print "Processing QUIT $tag: $nick $addr $reason" if $debug;
        # If the quit message is registered, add the person to our quit hash and abort the signal.
        if ($reason eq "Registered") {
                $quits{$nick} = 1;
@@ -76,15 +78,18 @@ sub message_irc_mode {
        if (process_tag($tag) == 0) {
                return 0;
        }
-       Irssi::print "Processing MIM $tag: $channel $nick $addr $mode";
+       Irssi::print "Processing MIM $tag: $channel $nick $addr $mode" if $debug;
        my $servermask = Irssi::settings_get_str('quakequit_servermask');
        # If the server is setting the mode, the $nick will be the server mask and $addr will be empty.
        if ($nick eq $servermask) {
+               Irssi::print "$nick == $servermask" if $debug;
                # break the target nicks away from the modes set on them.
                my ($modes, @targets) = split / /, $mode, 2;
                # If the nick exists in the hash and the mode setter is *.quakenet.org, signal_stop.
                foreach my $target (@targets) {
+                       Irssi::print "Processing $target" if $debug;
                        if ($quits{$target} == 1) {
+                               Irssi::print "Found $target in target list, stopping signal" if $debug;
                                Irssi::signal_stop();
                                return 0;
                        }
@@ -98,6 +103,6 @@ sub message_irc_mode {
 Irssi::settings_add_str('quakequit', 'quakequit_networks', 'QuakeNet');
 Irssi::settings_add_str('quakequit', 'quakequit_servermask', '*.quakenet.org');
 # Signals to grab
-Irssi::signal_add_last('message irc mode', 'message_irc_mode');
+Irssi::signal_add_first('message irc mode', 'message_irc_mode');
 Irssi::signal_add_last('message join', 'message_join');
 Irssi::signal_add_last('message quit', 'message_quit');
git clone https://git.99rst.org/PROJECT