mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-29 23:39:24 +01:00
Increase join flood detection to 4 joins within 30 minutes without a message; set join_watch -= 2 on join ban to allow two join attempts afterwards in order to give them a chance to rejoin
This commit is contained in:
parent
4b342be290
commit
7bcfa52b25
@ -67,7 +67,7 @@ sub check_flood {
|
|||||||
${ $self->message_history }{$nick}{$channel}{messages} = [];
|
${ $self->message_history }{$nick}{$channel}{messages} = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
print "$nick $channel joinwatch: ${ $self->message_history }{$nick}{$channel}{join_watch}\n";
|
$self->{pbot}->logger->log("$nick $channel joinwatch: ${ $self->message_history }{$nick}{$channel}{join_watch}\n");
|
||||||
|
|
||||||
#$self->{pbot}->logger->log("appending new message\n");
|
#$self->{pbot}->logger->log("appending new message\n");
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ sub check_flood {
|
|||||||
my %msg = %{ @{ ${ $self->message_history }{$nick}{$channel}{messages} }[$length - $max_messages] };
|
my %msg = %{ @{ ${ $self->message_history }{$nick}{$channel}{messages} }[$length - $max_messages] };
|
||||||
my %last = %{ @{ ${ $self->message_history }{$nick}{$channel}{messages} }[$length - 1] };
|
my %last = %{ @{ ${ $self->message_history }{$nick}{$channel}{messages} }[$length - 1] };
|
||||||
|
|
||||||
$self->{pbot}->logger->log("Comparing $last{timestamp} against $msg{timestamp}: " . (int($last{timestamp} - $msg{timestamp})) . " seconds\n");
|
$self->{pbot}->logger->log("Comparing " . int($last{timestamp}) . " against " . int($msg{timestamp}) . ": " . (int($last{timestamp} - $msg{timestamp})) . " seconds\n");
|
||||||
|
|
||||||
if($last{timestamp} - $msg{timestamp} <= $max_time && not $self->{pbot}->admins->loggedin($channel, "$nick!$user\@$host")) {
|
if($last{timestamp} - $msg{timestamp} <= $max_time && not $self->{pbot}->admins->loggedin($channel, "$nick!$user\@$host")) {
|
||||||
if($mode == $self->{FLOOD_JOIN}) {
|
if($mode == $self->{FLOOD_JOIN}) {
|
||||||
@ -101,6 +101,7 @@ sub check_flood {
|
|||||||
$self->{pbot}->chanops->quiet_user_timed("*!$user\@$host", $channel, 60 * 60);
|
$self->{pbot}->chanops->quiet_user_timed("*!$user\@$host", $channel, 60 * 60);
|
||||||
$self->{pbot}->logger->log("$nick!$user\@$host banned for one hour due to join flooding.\n");
|
$self->{pbot}->logger->log("$nick!$user\@$host banned for one hour due to join flooding.\n");
|
||||||
$self->{pbot}->conn->privmsg($nick, "You have been banned from $channel for one hour due to join flooding.");
|
$self->{pbot}->conn->privmsg($nick, "You have been banned from $channel for one hour due to join flooding.");
|
||||||
|
${ $self->message_history }{$nick}{$channel}{join_watch} = $max_messages - 2; # give them a chance to rejoin
|
||||||
}
|
}
|
||||||
} elsif($mode == $self->{FLOOD_CHAT}) {
|
} elsif($mode == $self->{FLOOD_CHAT}) {
|
||||||
${ $self->message_history }{$nick}{$channel}{offenses}++;
|
${ $self->message_history }{$nick}{$channel}{offenses}++;
|
||||||
@ -141,7 +142,7 @@ sub check_flood {
|
|||||||
} elsif($mode == $self->{FLOOD_CHAT}) {
|
} elsif($mode == $self->{FLOOD_CHAT}) {
|
||||||
${ $self->message_history }{$nick}{$channel}{join_watch} = 0;
|
${ $self->message_history }{$nick}{$channel}{join_watch} = 0;
|
||||||
}
|
}
|
||||||
print "$nick $channel joinwatch adjusted: ${ $self->message_history }{$nick}{$channel}{join_watch}\n";
|
$self->{pbot}->logger->log("$nick $channel joinwatch adjusted: ${ $self->message_history }{$nick}{$channel}{join_watch}\n");
|
||||||
} else {
|
} else {
|
||||||
#$self->{pbot}->logger->log("brand new nick addition\n");
|
#$self->{pbot}->logger->log("brand new nick addition\n");
|
||||||
# new addition
|
# new addition
|
||||||
|
@ -155,7 +155,7 @@ sub on_join {
|
|||||||
my ($nick, $user, $host, $channel) = ($event->nick, $event->user, $event->host, $event->to);
|
my ($nick, $user, $host, $channel) = ($event->nick, $event->user, $event->host, $event->to);
|
||||||
|
|
||||||
#$self->{pbot}->logger->log("$nick!$user\@$host joined $channel\n");
|
#$self->{pbot}->logger->log("$nick!$user\@$host joined $channel\n");
|
||||||
$self->{pbot}->antiflood->check_flood($channel, $nick, $user, $host, "JOIN", 3, 90, $self->{pbot}->{FLOOD_JOIN});
|
$self->{pbot}->antiflood->check_flood($channel, $nick, $user, $host, "JOIN", 3, 60 * 30, $self->{pbot}->{FLOOD_JOIN});
|
||||||
}
|
}
|
||||||
|
|
||||||
sub on_departure {
|
sub on_departure {
|
||||||
|
@ -13,8 +13,8 @@ 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 => 143,
|
BUILD_REVISION => 144,
|
||||||
BUILD_DATE => "2010-06-04",
|
BUILD_DATE => "2010-06-05",
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
Reference in New Issue
Block a user