diff options
| author | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
|---|---|---|
| committer | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
| commit | 2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1 (patch) | |
| tree | 1c5e6d817c88e67b46e216a50e0aef5428bf63df /scripts/colorkick.pl | |
| parent | 2d080422d79d1fd49d6c5528593ccaaff9bfc583 (diff) | |
| download | scripts.irssi.org-2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1.tar.bz2 | |
Import scripts from scripts.irssi.org
Diffstat (limited to 'scripts/colorkick.pl')
| -rw-r--r-- | scripts/colorkick.pl | 68 | 
1 files changed, 68 insertions, 0 deletions
| diff --git a/scripts/colorkick.pl b/scripts/colorkick.pl new file mode 100644 index 0000000..8b07aa0 --- /dev/null +++ b/scripts/colorkick.pl @@ -0,0 +1,68 @@ +#!/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 Irssi; +use Irssi::Irc; + +use vars %IRSSI; +%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		=> "Fri Jan  2 03:43:10 CET 2004" +); + +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 == $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"); | 
