3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-19 10:29:30 +01:00

AntiFlood: update last_spoken_nick properly

This commit is contained in:
Pragmatic Software 2020-03-22 13:28:04 -07:00
parent 0dce5861f3
commit 55de922aa6

View File

@ -208,7 +208,7 @@ sub check_flood {
$account = $self->{pbot}->{messagehistory}->get_message_account($newnick, $user, $host); $account = $self->{pbot}->{messagehistory}->get_message_account($newnick, $user, $host);
$nick = $newnick; $nick = $newnick;
} else { } else {
$self->{pbot}->{logger}->log(sprintf("%-18s | %-65s | %s\n", lc $channel eq lc $mask ? "QUIT" : $channel, $mask, $text)); $self->{pbot}->{logger}->log(sprintf("%-18s | %-65s | %s\n", $channel eq lc $mask ? "QUIT" : $channel, $mask, $text));
} }
# do not do flood processing for bot messages # do not do flood processing for bot messages
@ -242,7 +242,6 @@ sub check_flood {
$self->{pbot}->{messagehistory}->{database}->devalidate_all_channels($account); $self->{pbot}->{messagehistory}->{database}->devalidate_all_channels($account);
if ($text eq 'QUIT Changing host') { if ($text eq 'QUIT Changing host') {
$self->{pbot}->{logger}->log("$mask [$account] changing host!\n");
$self->{changinghost}->{$nick} = $account; $self->{changinghost}->{$nick} = $account;
} }
@ -251,8 +250,9 @@ sub check_flood {
} }
my $channels; my $channels;
if ($mode == $self->{pbot}->{messagehistory}->{MSG_NICKCHANGE}) { $channels = $self->{pbot}->{nicklist}->get_channels($oldnick); } if ($mode == $self->{pbot}->{messagehistory}->{MSG_NICKCHANGE}) {
else { $channels = $self->{pbot}->{nicklist}->get_channels($oldnick);
} else {
$self->update_join_watch($account, $channel, $text, $mode); $self->update_join_watch($account, $channel, $text, $mode);
push @$channels, $channel; push @$channels, $channel;
} }
@ -526,6 +526,8 @@ sub check_flood {
} }
} }
} }
$self->{channels}->{$channel}->{last_spoken_nick} = $nick if $mode == $self->{pbot}->{messagehistory}->{MSG_CHAT};
} }
sub unbanme { sub unbanme {