1use strict; 2use vars qw($VERSION %IRSSI); 3$VERSION = "1.1"; 4%IRSSI = ( 5 authors => "Roeland 'Trancer' Nieuwenhuis", 6 contact => "irssi\@trancer.nl", 7 name => "nickban", 8 description => "A simple nick banner. If it encounters a nick it bans its host", 9 license => "Public Domain" 10); 11 12use Irssi; 13 14# The channels the nicks are banned on (on which this script is active) 15my @channels = qw(#worldchat #chat-world #php); 16 17# The banned nicks 18my @nicks = qw(evildude evilgirl); 19 20# Your kickreason 21my $kickreason = "Not welcome here."; 22 23sub nick_banner { 24 25 my($server, $channel, $nick, $address) = @_; 26 27 # Are we opped? 28 return unless $server->channel_find($channel)->{chanop}; 29 30 # If the nick is a server, stop it. 31 return if $nick eq $server->{nick}; 32 33 # Is the user a banned nick? 34 my $nono = 0; 35 foreach (@nicks) { $nono = 1 if lc($nick) eq lc($_) } 36 return unless $nono; 37 38 # Is the user on one of the banned channels? 39 my $react = 0; 40 foreach (@channels) { $react = 1 if lc($channel) eq lc($_) } 41 return unless $react; 42 43 # User voiced or op'd? 44 # Pretty useless, but ok 45 return if $server->channel_find($channel)->nick_find($nick)->{op} || $server->channel_find($channel)->nick_find($nick)->{voice}; 46 47 $server->command("kickban $channel $nick $kickreason"); 48 Irssi::print("Nick banning $nick on $channel. Banned."); 49} 50 51Irssi::signal_add_last('message join', 'nick_banner'); 52