]> git.donarmstrong.com Git - infobot.git/commitdiff
added reason on ban.
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 13 Feb 2001 14:30:03 +0000 (14:30 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 13 Feb 2001 14:30:03 +0000 (14:30 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@389 c11ca15a-4712-0410-83d8-924469b57eb5

src/IRC/IrcHooks.pl

index 6e9bf14bae649daf0c5a4b457eaf4a1dcdca5463..a5a81566d902789c4da7b48d0dcd6ceb6b5d80a1 100644 (file)
@@ -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;
     }