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

Correct joinwatch behavior for netsplits; remove joinwatch behavior for "Changing host"

This commit is contained in:
Pragmatic Software 2010-06-11 08:01:32 +00:00
parent 0ce7f52725
commit 4242eecf43
2 changed files with 12 additions and 6 deletions

View File

@ -107,12 +107,18 @@ sub check_flood {
if($mode == $self->{FLOOD_JOIN}) {
if($text =~ /^JOIN/) {
${ $self->message_history }{$account}{$channel}{join_watch}++;
$self->{pbot}->logger->log("$nick $channel joinwatch adjusted: ${ $self->message_history }{$account}{$channel}{join_watch}\n");
} else {
# PART or QUIT -- check PART/QUIT message for netsplits or changing host, and decrement joinwatch if found
${ $self->message_history }{$account}{$channel}{join_watch}-- if($text =~ /^QUIT Changing host/ or $text =~ /^QUIT .*\.net .*\.split/);
${ $self->message_history }{$account}{$channel}{join_watch} = 0 if ${ $self->message_history }{$account}{$channel}{join_watch} < 0;
# PART or QUIT -- check QUIT message for netsplits, and decrement joinwatch if found
if($text =~ /^QUIT .*\.net .*\.split/) {
foreach my $ch (keys %{ $self->message_history->{$account} }) {
next if $ch eq 'hostmask'; # TODO: move channels into {channel} subkey
${ $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");
}
}
}
$self->{pbot}->logger->log("$nick $channel joinwatch adjusted: ${ $self->message_history }{$account}{$channel}{join_watch}\n");
} elsif($mode == $self->{FLOOD_CHAT}) {
${ $self->message_history }{$account}{$channel}{join_watch} = 0;
}

View File

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