diff --git a/lib/PBot/Core/AntiFlood.pm b/lib/PBot/Core/AntiFlood.pm index 59a310c4..cf5cf391 100644 --- a/lib/PBot/Core/AntiFlood.pm +++ b/lib/PBot/Core/AntiFlood.pm @@ -140,15 +140,22 @@ sub check_flood { $self->{pbot}->{messagehistory}->{database}->update_hostmask_data($mask, {last_seen => scalar gettimeofday}); if ($mode == MSG_NICKCHANGE) { - $self->{pbot}->{logger}->log(sprintf("%-18s | %-65s | %s\n", "NICKCHANGE", $mask, $text)); - my ($newnick) = $text =~ m/NICKCHANGE (.*)/; + + $self->{pbot}->{logger}->log("[NICKCHANGE] ($account) $mask changed nick to $newnick\n"); + $mask = "$newnick!$user\@$host"; $account = $self->{pbot}->{messagehistory}->get_message_account($newnick, $user, $host); $nick = $newnick; $self->{pbot}->{messagehistory}->{database}->update_hostmask_data($mask, {last_seen => scalar gettimeofday}); } else { - $self->{pbot}->{logger}->log(sprintf("%-18s | %-65s | %s\n", $channel eq lc $mask ? "QUIT" : $channel, $mask, $text)); + if ($mode == MSG_CHAT) { + $self->{pbot}->{logger}->log("[MSG] $channel ($account) $mask => $text\n"); + } else { + my $from = $channel eq lc $mask ? "QUIT" : $channel; + my ($type) = $text =~ /^(\w+) /; + $self->{pbot}->{logger}->log("[$type] $from ($account) $mask => $text\n"); + } } # do not do flood processing for bot messages diff --git a/lib/PBot/Core/Handlers/Channel.pm b/lib/PBot/Core/Handlers/Channel.pm index 3f8613fb..bda9fb55 100644 --- a/lib/PBot/Core/Handlers/Channel.pm +++ b/lib/PBot/Core/Handlers/Channel.pm @@ -62,7 +62,7 @@ sub on_mode { $mode = $modifier . $flag; $target = $event->{event}->{args}->[++$i]; - $self->{pbot}->{logger}->log("Mode $channel [$mode" . (length $target ? " $target" : '') . "] by $source\n"); + $self->{pbot}->{logger}->log("[MODE] $channel $mode" . (length $target ? " $target" : '') . " by $source\n"); # dispatch a single mode flag event $self->{pbot}->{event_dispatcher}->dispatch_event( diff --git a/lib/PBot/Core/MessageHistory/Storage/SQLite.pm b/lib/PBot/Core/MessageHistory/Storage/SQLite.pm index f50b7102..8400b761 100644 --- a/lib/PBot/Core/MessageHistory/Storage/SQLite.pm +++ b/lib/PBot/Core/MessageHistory/Storage/SQLite.pm @@ -1744,7 +1744,7 @@ sub get_also_known_as { my ($self, $nick, $dont_use_aliases_table) = @_; my $debug = $self->{pbot}->{registry}->get_value('messagehistory', 'debug_aka'); - $self->{pbot}->{logger}->log("Looking for AKAs for nick [$nick]\n") if $debug; + $self->{pbot}->{logger}->log("[AKA] Checking nick $nick\n") if $debug; my %akas = eval { my (%akas, %hostmasks, %ids); @@ -1755,7 +1755,7 @@ sub get_also_known_as { if (not defined $id) { return %akas; } $ids{$id} = {id => $id, type => $self->{alias_type}->{STRONG}}; - $self->{pbot}->{logger}->log("Adding $id -> $id\n") if $debug; + $self->{pbot}->{logger}->log("Adding $id -> $id\n") if $debug > 2; my $sth = $self->{dbh}->prepare('SELECT alias, type FROM Aliases WHERE id = ?'); $sth->execute($id); @@ -1764,7 +1764,7 @@ sub get_also_known_as { foreach my $row (@$rows) { # next if $row->{type} == $self->{alias_type}->{WEAK}; $ids{$row->{alias}} = {id => $id, type => $row->{type}}; - $self->{pbot}->{logger}->log("[$id] 1) Adding $row->{alias} -> $id [type $row->{type}]\n") if $debug; + $self->{pbot}->{logger}->log("[$id] 1) Adding $row->{alias} -> $id [type $row->{type}]\n") if $debug > 2; } my %seen_id; @@ -1786,7 +1786,7 @@ sub get_also_known_as { #next if $row->{type} == $self->{alias_type}->{WEAK}; $ids{$row->{id}} = {id => $id, type => $ids{$id}->{type} == $self->{alias_type}->{WEAK} ? $self->{alias_type}->{WEAK} : $row->{type}}; $new_aliases++; - $self->{pbot}->{logger}->log("[$id] 2) Adding $row->{id} -> $id [type $row->{type}]\n") if $debug; + $self->{pbot}->{logger}->log("[$id] 2) Adding $row->{id} -> $id [type $row->{type}]\n") if $debug > 2; } } last if not $new_aliases; @@ -1816,7 +1816,7 @@ sub get_also_known_as { last_seen => $row->{last_seen}, }; - $self->{pbot}->{logger}->log("[$id] Adding hostmask $row->{hostmask} -> $ids{$id}->{id} [type $ids{$id}->{type}]\n") if $debug; + $self->{pbot}->{logger}->log("[AKA] hostmask ($id) $row->{hostmask} -> $ids{$id}->{id} [type $ids{$id}->{type}]\n") if $debug; } $nickserv_sth->execute($id); diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index d60b7222..47e6c8ca 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4608, - BUILD_DATE => "2023-01-28", + BUILD_REVISION => 4609, + BUILD_DATE => "2023-01-30", }; sub initialize {}