3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-04 18:38:47 +02:00

antiflood: do not do anti-flood if lag is two seconds or greater

This commit is contained in:
Pragmatic Software 2011-01-22 09:39:39 +00:00
parent b11b660929
commit 1f45da7615
2 changed files with 5 additions and 1 deletions

View File

@ -48,6 +48,7 @@ sub initialize {
$self->{last_timestamp} = gettimeofday;
$self->{message_history} = {};
$self->{lag} = undef;
$self->{lag_history} = [];
$self->{LAG_HISTORY_MAX} = 3;
$self->{LAG_HISTORY_INTERVAL} = 10;
@ -182,6 +183,9 @@ sub check_flood {
# do not do flood processing if channel is not in bot's channel list or bot is not set as chanop for the channel
return if ($channel =~ /^#/) and (not exists $self->{pbot}->channels->channels->hash->{$channel} or $self->{pbot}->channels->channels->hash->{$channel}{chanop} == 0);
# do not do flood processing for this event if lag is significant
return if defined $self->{lag} and $self->{lag} >= 2;
if($max_messages > $self->{pbot}->{MAX_NICK_MESSAGES}) {
$self->{pbot}->logger->log("Warning: max_messages greater than MAX_NICK_MESSAGES; truncating.\n");
$max_messages = $self->{pbot}->{MAX_NICK_MESSAGES};

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 246,
BUILD_REVISION => 247,
BUILD_DATE => "2011-01-22",
};