summaryrefslogtreecommitdiffstats
path: root/scripts/wkb.pl
diff options
context:
space:
mode:
authorAlexander Færøy2014-05-31 13:10:46 +0200
committerAlexander Færøy2014-05-31 13:10:46 +0200
commit2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1 (patch)
tree1c5e6d817c88e67b46e216a50e0aef5428bf63df /scripts/wkb.pl
parent2d080422d79d1fd49d6c5528593ccaaff9bfc583 (diff)
downloadscripts.irssi.org-2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1.tar.bz2
Import scripts from scripts.irssi.org
Diffstat (limited to 'scripts/wkb.pl')
-rw-r--r--scripts/wkb.pl57
1 files changed, 57 insertions, 0 deletions
diff --git a/scripts/wkb.pl b/scripts/wkb.pl
new file mode 100644
index 0000000..527536a
--- /dev/null
+++ b/scripts/wkb.pl
@@ -0,0 +1,57 @@
+use Irssi 20020217; # Irssi 0.8.0
+$VERSION = "1.1";
+%IRSSI = (
+ authors => "Matti 'qvr' Hiljanen",
+ contact => "matti\@hiljanen.com",
+ name => "wkb",
+ description => "A simple word kickbanner",
+ license => "Public Domain",
+ url => "http://matin.maapallo.org/softa/irssi",
+);
+
+use strict;
+use Irssi;
+
+my @channels =
+ qw(#foo #foo2);
+
+my @words =
+ qw(bad_word bad_word2);
+
+my @gods =
+ qw(qvr other_gods);
+
+sub sig_public {
+ my ($server, $msg, $nick, $address, $target) = @_;
+
+ return if $nick eq $server->{nick};
+
+ $msg =~ s/[\000-\037]//g;
+ my $rmsg = $msg;
+ $msg = lc($msg);
+
+ # bad word
+ my $nono = 0;
+ foreach (@words) { $nono = 1 if $msg =~ /$_/ }
+ return unless $nono;
+
+ # channel?
+ my $react = 0;
+ foreach (@channels) { $react = 1 if lc($target) eq lc($_) }
+ return unless $react;
+
+ # god-like person?
+ my $jumala = 0;
+ foreach (@gods) { $jumala = 1 if lc($nick) =~ /$_/ }
+ return if $jumala;
+
+ # voiced or op'd?
+ return if $server->channel_find($target)->nick_find($nick)->{op} || $server->channel_find($target)->nick_find($nick)->{voice};
+
+ $server->command("kickban $target $nick WKB initiated");
+ Irssi::print("Word kick: Kicking $nick from $target. (He said $rmsg)");
+}
+
+Irssi::signal_add_last('message public', 'sig_public');
+
+