mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-03 16:42:38 +01:00
Make anti-flood logs less spammy
This commit is contained in:
parent
9b3a8f1284
commit
71847ddc63
@ -67,8 +67,6 @@ sub check_flood {
|
|||||||
${ $self->message_history }{$nick}{$channel}{messages} = [];
|
${ $self->message_history }{$nick}{$channel}{messages} = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$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");
|
||||||
|
|
||||||
push(@{ ${ $self->message_history }{$nick}{$channel}{messages} }, { timestamp => $now, msg => $text, mode => $mode });
|
push(@{ ${ $self->message_history }{$nick}{$channel}{messages} }, { timestamp => $now, msg => $text, mode => $mode });
|
||||||
@ -98,9 +96,9 @@ sub check_flood {
|
|||||||
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}) {
|
||||||
if(${ $self->message_history }{$nick}{$channel}{join_watch} >= $max_messages) {
|
if(${ $self->message_history }{$nick}{$channel}{join_watch} >= $max_messages) {
|
||||||
$self->{pbot}->chanops->quiet_user_timed("*!$user\@$host", $channel, 60 * 60);
|
$self->{pbot}->chanops->quiet_user_timed("*!$user\@$host", $channel, 60 * 60 * 2);
|
||||||
$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 two hours 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 two hours due to join flooding.");
|
||||||
${ $self->message_history }{$nick}{$channel}{join_watch} = $max_messages - 2; # give them a chance to rejoin
|
${ $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}) {
|
||||||
@ -139,10 +137,10 @@ sub check_flood {
|
|||||||
|
|
||||||
if($mode == $self->{FLOOD_JOIN}) {
|
if($mode == $self->{FLOOD_JOIN}) {
|
||||||
${ $self->message_history }{$nick}{$channel}{join_watch}++;
|
${ $self->message_history }{$nick}{$channel}{join_watch}++;
|
||||||
|
$self->{pbot}->logger->log("$nick $channel joinwatch adjusted: ${ $self->message_history }{$nick}{$channel}{join_watch}\n");
|
||||||
} 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;
|
||||||
}
|
}
|
||||||
$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
|
||||||
|
Loading…
Reference in New Issue
Block a user