mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-10 20:12:35 +01:00
antiflood: do not do anti-flood if lag is two seconds or greater
This commit is contained in:
parent
b11b660929
commit
1f45da7615
@ -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};
|
||||
|
@ -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",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user