From: phyber Date: Mon, 2 Mar 2009 08:36:48 +0000 (+0000) Subject: (quakequit) Added script 'quakequit.pl' X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=6c37de5ab56a4a8aa02a43004f538136259cf7ab;p=irssi-scripts.irssi.org.git (quakequit) Added script 'quakequit.pl' --- diff --git a/scripts/quakequit.pl b/scripts/quakequit.pl new file mode 100644 index 0000000..5341925 --- /dev/null +++ b/scripts/quakequit.pl @@ -0,0 +1,41 @@ +use strict; +use Irssi; +use vars qw($VERSION %IRSSI); +$VERSION = "1.0"; +%IRSSI = ( + authors => "David O\'Rourke", + contact => "phyber [at] #irssi", + name => "quakequit", + description => "Hide the stupid quit/join on QuakeNet when a user registers with nickserv.", + licence => "GPLv2", + changed => "02/03/2009", +); + +# Hash to store our temporary ignores in. +my %quits; + +sub message_join { + my ($server_rec, $nick, $addr) = @_; + my $tag = $server_rec->{tag}; + # If the joining nick is in our quit hash, don't show the join. + if (($tag eq "QuakeNet") and (defined $quits{$nick})) { + delete $quits{$nick}; + Irssi::signal_stop(); + return 0; + } +} + +sub message_quit { + my ($server_rec, $nick, $addr, $reason) = @_; + my $tag = $server_rec->{tag}; + # If the quit message is registered, add the person to our quit hash and abort the signal. + if (($tag eq "QuakeNet") and ($reason eq "Registered")) { + $quits{$nick} = 1; + Irssi::signal_stop(); + return 0; + } +} + +# Signals to grab +Irssi::signal_add('message join', 'message_join'); +Irssi::signal_add('message quit', 'message_quit');