]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
(quakequit) Added script 'quakequit.pl'
authorphyber <redacted>
Mon, 2 Mar 2009 08:36:48 +0000 (08:36 +0000)
committerbw1 <redacted>
Sun, 14 Jan 2018 21:00:15 +0000 (22:00 +0100)
scripts/quakequit.pl [new file with mode: 0644]

diff --git a/scripts/quakequit.pl b/scripts/quakequit.pl
new file mode 100644 (file)
index 0000000..5341925
--- /dev/null
@@ -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');
git clone https://git.99rst.org/PROJECT