3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-01-11 12:32:37 +01:00

Ping timeout quits now handled

This commit is contained in:
Pragmatic Software 2010-06-12 04:38:38 +00:00
parent ef3d9770ca
commit 40ed750a1f
2 changed files with 23 additions and 5 deletions

View File

@ -118,7 +118,19 @@ sub check_flood {
${ $self->message_history }{$account}{$channel}{join_watch}++; ${ $self->message_history }{$account}{$channel}{join_watch}++;
$self->{pbot}->logger->log("$nick $channel joinwatch adjusted: ${ $self->message_history }{$account}{$channel}{join_watch}\n"); $self->{pbot}->logger->log("$nick $channel joinwatch adjusted: ${ $self->message_history }{$account}{$channel}{join_watch}\n");
} else { } else {
# PART or QUIT -- check QUIT message for netsplits, and decrement joinwatch if found # PART or QUIT
# if QUIT, then assume they existed on any channel the bot exists on
# this makes it possible to deal with ping timeout quits
foreach my $chan (keys %{ $self->{pbot}->channels->channels }) {
if(not exists ${ $self->message_history }{$account}{$chan}) {
${ $self->message_history }{$account}{$chan}{offenses} = 0;
${ $self->message_history }{$account}{$chan}{join_watch} = 0;
${ $self->message_history }{$account}{$chan}{messages} = [];
}
}
# check QUIT message for netsplits, and decrement joinwatch if found
if($text =~ /^QUIT .*\.net .*\.split/) { if($text =~ /^QUIT .*\.net .*\.split/) {
foreach my $ch (keys %{ $self->message_history->{$account} }) { foreach my $ch (keys %{ $self->message_history->{$account} }) {
next if $ch eq 'hostmask'; # TODO: move channels into {channel} subkey next if $ch eq 'hostmask'; # TODO: move channels into {channel} subkey
@ -126,10 +138,16 @@ sub check_flood {
${ $self->message_history }{$account}{$ch}{join_watch} = 0 if ${ $self->message_history }{$account}{$ch}{join_watch} < 0; ${ $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 $ch joinwatch adjusted: ${ $self->message_history }{$account}{$ch}{join_watch}\n");
} }
} elsif($text =~ /^QUIT Ping timeout/) { }
# check QUIT message for Ping timeout
elsif($text =~ /^QUIT Ping timeout/) {
# deal with ping timeouts agressively # deal with ping timeouts agressively
${ $self->message_history }{$account}{$channel}{join_watch}++; foreach my $ch (keys %{ $self->message_history->{$account} }) {
$self->{pbot}->logger->log("$nick $channel joinwatch adjusted: ${ $self->message_history }{$account}{$channel}{join_watch}\n"); 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");
}
} }
} }
} elsif($mode == $self->{FLOOD_CHAT}) { } elsif($mode == $self->{FLOOD_CHAT}) {

View File

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