3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00

Add missing message to message history for QUITs; skip joinwatch on non-channels; add max_messages and max_timeout to QUIT/PART in IRCHandlers

This commit is contained in:
Pragmatic Software 2010-06-12 05:50:38 +00:00
parent 6eeb2277f2
commit f14924a619
3 changed files with 6 additions and 2 deletions

View File

@ -127,6 +127,7 @@ sub check_flood {
${ $self->message_history }{$account}{$chan}{offenses} = 0;
${ $self->message_history }{$account}{$chan}{join_watch} = 0;
${ $self->message_history }{$account}{$chan}{messages} = [];
push(@{ ${ $self->message_history }{$account}{$chan}{messages} }, { timestamp => $now, msg => $text, mode => $mode });
}
}
@ -134,6 +135,7 @@ sub check_flood {
if($text =~ /^QUIT .*\.net .*\.split/) {
foreach my $ch (keys %{ $self->message_history->{$account} }) {
next if $ch eq 'hostmask'; # TODO: move channels into {channel} subkey
next if $ch !~ /^#/;
${ $self->message_history }{$account}{$ch}{join_watch}--;
${ $self->message_history }{$account}{$ch}{join_watch} = 0 if ${ $self->message_history }{$account}{$ch}{join_watch} < 0;
$self->{pbot}->logger->log("$nick $ch joinwatch adjusted: ${ $self->message_history }{$account}{$ch}{join_watch}\n");
@ -144,12 +146,14 @@ sub check_flood {
# deal with ping timeouts agressively
foreach my $ch (keys %{ $self->message_history->{$account} }) {
next if $ch eq 'hostmask'; # TODO: move channels into {channel} subkey
next if $ch !~ /^#/;
${ $self->message_history }{$account}{$ch}{join_watch}++;
$self->{pbot}->logger->log("$nick $ch joinwatch adjusted: ${ $self->message_history }{$account}{$ch}{join_watch}\n");
}
}
}
} elsif($mode == $self->{FLOOD_CHAT}) {
# reset joinwatch if they send a message
${ $self->message_history }{$account}{$channel}{join_watch} = 0;
}

View File

@ -165,7 +165,7 @@ sub on_departure {
my $text = uc $event->type;
$text .= " $args";
$self->{pbot}->antiflood->check_flood($channel, $nick, $user, $host, $text, 0, 0, $self->{pbot}->antiflood->{FLOOD_JOIN});
$self->{pbot}->antiflood->check_flood($channel, $nick, $user, $host, $text, 4, 60 * 30, $self->{pbot}->antiflood->{FLOOD_JOIN});
=cut
if(exists $admins{$nick} && exists $admins{$nick}{login}) {

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 162,
BUILD_REVISION => 163,
BUILD_DATE => "2010-06-11",
};