1#!/usr/local/bin/perl 2# 3# script what's kicking users for using color or blink 4# 5# settings: 6# what type function 7# colorkick_channels str list of channels have to be ``protected'' 8# colorkick_color int 0: don't kick on color 9# colorkick_blink int 0: don't kick on blink 10# 11 12use strict; 13use Irssi; 14use Irssi::Irc; 15 16use vars qw/%IRSSI $VERSION/; 17$VERSION='0.1'; 18%IRSSI = 19( 20 authors => "Gabor Nyeki", 21 contact => "bigmac\@vim.hu", 22 name => "colorkick", 23 description => "kicking users for using colors or blinks", 24 license => "public domain", 25 written => "Thu Dec 26 00:22:54 CET 2002", 26 changed => "2017-03-07" 27); 28 29sub catch_junk 30{ 31 my ($server, $data, $nick, $address) = @_; 32 my ($target, $text) = split(/ :/, $data, 2); 33 my $valid_channel = 0; 34 35 #if ($target[0] != '#' && $target[0] != '!' && $target[0] != '&') 36 #{ 37 # return; 38 #} 39 40 for my $channel (split(/ /, 41 Irssi::settings_get_str('colorkick_channels'))) 42 { 43 if ($target eq $channel) 44 { 45 $valid_channel = 1; 46 last; 47 } 48 } 49 if ($valid_channel == 0) 50 { 51 return; 52 } 53 54 if ($text =~ /\x3/ && 55 Irssi::settings_get_bool('colorkick_color')) 56 { 57 $server->send_raw("KICK $target $nick :color abuse"); 58 } 59 elsif ($text =~ /\x6/ && 60 Irssi::settings_get_bool('colorkick_blink')) 61 { 62 $server->send_raw("KICK $target $nick :blink abuse"); 63 } 64} 65 66Irssi::settings_add_str('colorkick', 'colorkick_channels', ''); 67Irssi::settings_add_bool('colorkick', 'colorkick_color', 1); 68Irssi::settings_add_bool('colorkick', 'colorkick_blink', 1); 69Irssi::signal_add("event privmsg", "catch_junk"); 70