mirror of https://github.com/pragma-/pbot.git
Correct logic for Guest nick-change allowance
This commit is contained in:
parent
a7681c36cb
commit
2e2188532c
|
@ -170,7 +170,13 @@ sub check_flood {
|
||||||
|
|
||||||
if($mode == $self->{pbot}->{messagehistory}->{MSG_NICKCHANGE}) {
|
if($mode == $self->{pbot}->{messagehistory}->{MSG_NICKCHANGE}) {
|
||||||
$self->{pbot}->logger->log(sprintf("%-14s | %-65s | %s\n", "NICKCHANGE", $mask, $text));
|
$self->{pbot}->logger->log(sprintf("%-14s | %-65s | %s\n", "NICKCHANGE", $mask, $text));
|
||||||
|
|
||||||
|
my ($newnick) = $text =~ m/NICKCHANGE (.*)/;
|
||||||
|
if($newnick =~ m/^Guest\d+$/) {
|
||||||
|
# Don't enforce for services-mandated change to guest account
|
||||||
|
} else {
|
||||||
$self->{nickflood}->{$account}->{changes}++;
|
$self->{nickflood}->{$account}->{changes}++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$self->{pbot}->logger->log(sprintf("%-14s | %-65s | %s\n", $channel eq $mask ? "QUIT" : $channel, $mask, $text));
|
$self->{pbot}->logger->log(sprintf("%-14s | %-65s | %s\n", $channel eq $mask ? "QUIT" : $channel, $mask, $text));
|
||||||
}
|
}
|
||||||
|
@ -367,12 +373,6 @@ sub check_flood {
|
||||||
} elsif($mode == $self->{pbot}->{messagehistory}->{MSG_NICKCHANGE} and $self->{nickflood}->{$account}->{changes} >= $max_messages) {
|
} elsif($mode == $self->{pbot}->{messagehistory}->{MSG_NICKCHANGE} and $self->{nickflood}->{$account}->{changes} >= $max_messages) {
|
||||||
($nick) = $text =~ m/NICKCHANGE (.*)/;
|
($nick) = $text =~ m/NICKCHANGE (.*)/;
|
||||||
|
|
||||||
if($nick =~ m/^Guest\d+$/) {
|
|
||||||
# Don't enforce for services-mandated change to guest account
|
|
||||||
$self->{nickflood}->{$account}->{changes}--;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->{nickflood}->{$account}->{offenses}++;
|
$self->{nickflood}->{$account}->{offenses}++;
|
||||||
$self->{nickflood}->{$account}->{changes} = $max_messages - 2; # allow 1 more change (to go back to original nick)
|
$self->{nickflood}->{$account}->{changes} = $max_messages - 2; # allow 1 more change (to go back to original nick)
|
||||||
$self->{nickflood}->{$account}->{timestamp} = gettimeofday;
|
$self->{nickflood}->{$account}->{timestamp} = gettimeofday;
|
||||||
|
|
|
@ -13,7 +13,7 @@ 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 => 578,
|
BUILD_REVISION => 579,
|
||||||
BUILD_DATE => "2014-05-15",
|
BUILD_DATE => "2014-05-15",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue