summaryrefslogtreecommitdiffstats
path: root/scripts/colorkick.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/colorkick.pl')
-rw-r--r--scripts/colorkick.pl69
1 files changed, 69 insertions, 0 deletions
diff --git a/scripts/colorkick.pl b/scripts/colorkick.pl
new file mode 100644
index 0000000..c28e420
--- /dev/null
+++ b/scripts/colorkick.pl
@@ -0,0 +1,69 @@
+#!/usr/pkg/bin/perl
+#
+# script what's kicking users for using color or blink
+#
+# settings:
+# what type function
+# colorkick_channels str list of channels have to be ``protected''
+# colorkick_color int 0: don't kick on color
+# colorkick_blink int 0: don't kick on blink
+#
+
+use strict;
+use Irssi;
+use Irssi::Irc;
+
+use vars qw/%IRSSI $VERSION/;
+$VERSION='0.1';
+%IRSSI =
+(
+ authors => "Gabor Nyeki",
+ contact => "bigmac\@vim.hu",
+ name => "colorkick",
+ description => "kicking users for using colors or blinks",
+ license => "public domain",
+ written => "Thu Dec 26 00:22:54 CET 2002",
+ changed => "2017-03-07"
+);
+
+sub catch_junk
+{
+ my ($server, $data, $nick, $address) = @_;
+ my ($target, $text) = split(/ :/, $data, 2);
+ my $valid_channel = 0;
+
+ #if ($target[0] != '#' && $target[0] != '!' && $target[0] != '&')
+ #{
+ # return;
+ #}
+
+ for my $channel (split(/ /,
+ Irssi::settings_get_str('colorkick_channels')))
+ {
+ if ($target eq $channel)
+ {
+ $valid_channel = 1;
+ last;
+ }
+ }
+ if ($valid_channel == 0)
+ {
+ return;
+ }
+
+ if ($text =~ /\x3/ &&
+ Irssi::settings_get_bool('colorkick_color'))
+ {
+ $server->send_raw("KICK $target $nick :color abuse");
+ }
+ elsif ($text =~ /\x6/ &&
+ Irssi::settings_get_bool('colorkick_blink'))
+ {
+ $server->send_raw("KICK $target $nick :blink abuse");
+ }
+}
+
+Irssi::settings_add_str('colorkick', 'colorkick_channels', '');
+Irssi::settings_add_bool('colorkick', 'colorkick_color', 1);
+Irssi::settings_add_bool('colorkick', 'colorkick_blink', 1);
+Irssi::signal_add("event privmsg", "catch_junk");