From d2640f8bcbf84647ad16816123177ccc2ee8283b Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 22 Jan 2011 04:17:35 +0000 Subject: [PATCH] antiflood: remove generate_random_number; ping timeouts/excess floods no longer treated aggressively, now treated same as other quit/parts --- PBot/AntiFlood.pm | 24 +++++------------------- PBot/VERSION.pm | 4 ++-- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/PBot/AntiFlood.pm b/PBot/AntiFlood.pm index 408ffd26..5ad022b1 100644 --- a/PBot/AntiFlood.pm +++ b/PBot/AntiFlood.pm @@ -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; diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index bd7f11e0..7ac67606 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -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;