From: phyber Date: Fri, 6 Mar 2009 08:18:34 +0000 (+0000) Subject: (quakequit) use signal_add_first for 'message_irc_mode'. Add option to toggle debug... X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=79ea7d01e0d13dea5d0a9b0a1b2de5ab59805496;p=irssi-scripts.irssi.org.git (quakequit) use signal_add_first for 'message_irc_mode'. Add option to toggle debug output. --- diff --git a/scripts/quakequit.pl b/scripts/quakequit.pl index 1f8bf23..7840a13 100644 --- a/scripts/quakequit.pl +++ b/scripts/quakequit.pl @@ -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');