From 47d8f5724aa9329543487d3cc21d4d91e7b0927c Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 2 Feb 2023 09:22:51 -0800 Subject: [PATCH] Check for bans when CHGHOST Remove redundant message type from log message --- lib/PBot/Core/AntiFlood.pm | 3 ++- lib/PBot/Core/Handlers/Server.pm | 8 +++++++- lib/PBot/VERSION.pm | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/PBot/Core/AntiFlood.pm b/lib/PBot/Core/AntiFlood.pm index 73513ca3..648ab93c 100644 --- a/lib/PBot/Core/AntiFlood.pm +++ b/lib/PBot/Core/AntiFlood.pm @@ -154,7 +154,8 @@ sub check_flood { $self->{pbot}->{logger}->log("[MSG] $channel ($account) $mask => $text\n"); } else { my $from = $channel eq lc $mask ? undef : $channel; - my ($type) = $text =~ /^(\w+) /; + $text =~ s/^(\w+) //; + my $type = $1; $self->{pbot}->{logger}->log("[$type] " . (defined $from ? "$from " : '') . "($account) $mask => $text\n"); } } diff --git a/lib/PBot/Core/Handlers/Server.pm b/lib/PBot/Core/Handlers/Server.pm index 4c7c4fda..79397697 100644 --- a/lib/PBot/Core/Handlers/Server.pm +++ b/lib/PBot/Core/Handlers/Server.pm @@ -203,7 +203,13 @@ sub on_chghost { $self->{pbot}->{logger}->log("[CHGHOST] ($account) $nick!$user\@$host changed host to ($id) $nick!$newuser\@$newhost\n"); - return 1; + my $channels = $self->{pbot}->{nicklist}->get_channels($nick); + + foreach my $channel (@$channels) { + $self->{pbot}->{antiflood}->check_bans($id, "$nick!$newuser\@$newhost", $channel); + } + + return 1; } sub log_first_arg { diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 72249e2c..a78b513e 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,7 +25,7 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4615, + BUILD_REVISION => 4616, BUILD_DATE => "2023-02-02", };