3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-23 11:12:42 +01:00

antiflood: remove generate_random_number; ping timeouts/excess floods no longer treated aggressively, now treated same as other quit/parts

This commit is contained in:
Pragmatic Software 2011-01-22 04:17:35 +00:00
parent e943790827
commit d2640f8bcb
2 changed files with 7 additions and 21 deletions

View File

@ -93,11 +93,11 @@ sub add_message {
$self->{pbot}->logger->log("$account $channel joinwatch adjusted: ${ $self->message_history }{$account}{$channel}{join_watch}\n");
$self->message_history->{$account}{$channel}{messages}->[$length - 1]{mode} = $self->{FLOOD_IGNORE};
}
# check QUIT message for Ping timeout
elsif($text =~ /^QUIT Ping timeout/) {
# deal with ping timeouts agressively
${ $self->message_history }{$account}{$channel}{join_watch}++;
$self->{pbot}->logger->log("$account $channel joinwatch adjusted: ${ $self->message_history }{$account}{$channel}{join_watch}\n");
# check QUIT message for Ping timeout or Excess Flood
elsif($text =~ /^QUIT Ping timeout/ or $text =~ /^QUIT Excess Flood/) {
# deal with these aggressively
#${ $self->message_history }{$account}{$channel}{join_watch}++;
#$self->{pbot}->logger->log("$account $channel joinwatch adjusted: ${ $self->message_history }{$account}{$channel}{join_watch}\n");
} else {
# some other type of QUIT or PART
$self->message_history->{$account}{$channel}{messages}->[$length - 1]{mode} = $self->{FLOOD_IGNORE};
@ -333,18 +333,4 @@ sub address_to_mask {
return $banmask;
}
# based on Guy Malachi's code
sub generate_random_string {
my $length_of_randomstring = shift;
my @chars=('a'..'z','A'..'Z','0'..'9','_');
my $random_string;
foreach (1..$length_of_randomstring) {
$random_string .= $chars[rand @chars];
}
return $random_string;
}
1;

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 240,
BUILD_DATE => "2011-01-19",
BUILD_REVISION => 241,
BUILD_DATE => "2011-01-21",
};
1;