From: dms Date: Tue, 13 Feb 2001 14:30:03 +0000 (+0000) Subject: added reason on ban. X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7233958a901b8f350dc02d18531435f083646554;p=infobot.git added reason on ban. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@389 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/blootbot/src/IRC/IrcHooks.pl b/blootbot/src/IRC/IrcHooks.pl index 6e9bf14..a5a8156 100644 --- a/blootbot/src/IRC/IrcHooks.pl +++ b/blootbot/src/IRC/IrcHooks.pl @@ -429,18 +429,28 @@ sub on_join { my $ban = $_; s/\?/./g; s/\*/\\S*/g; - next unless ($nuh =~ /^$_$/i); + my $mask = $_; + next unless ($nuh =~ /^$mask$/i); ### TODO: check $channels{$chan}{'b'} if ban already exists. foreach (keys %{ $channels{$chan}{'b'} }) { &DEBUG(" bans_on_chan($chan) => $_"); } - &DEBUG("ban($ban, $chan);"); + my $reason = "no reason"; + foreach ($chan, "*") { + next unless (exists $bans{$_}); + next unless (exists $bans{$_}{$mask}); + + my @array = @{ $bans{$_}{$mask} }; + $reason ||= $array[4]; + last; + } + &DEBUG("on_join: ban: reason => '$reason'."); + &ban($ban, $chan); - ### TODO: get ban message from ban list. - &DEBUG("kick($who, $chan, NULL);"); - &kick($who, $chan, "NULL"); + &kick($who, $chan, $reason); + last; }