diff --git a/PBot/AntiFlood.pm b/PBot/AntiFlood.pm index 545377ce..3fda4e9d 100644 --- a/PBot/AntiFlood.pm +++ b/PBot/AntiFlood.pm @@ -240,7 +240,7 @@ sub check_flood { return if ($channel =~ /^#/) and (not exists $self->{pbot}->{channels}->{channels}->hash->{$channel} or $self->{pbot}->{channels}->{channels}->hash->{$channel}{chanop} == 0); if($channel =~ /^#/ and $mode == $self->{pbot}->{messagehistory}->{MSG_DEPARTURE}) { - # remove validation on PART so we check for ban-evasion when user returns at a later time + # remove validation on PART or KICK so we check for ban-evasion when user returns at a later time my $channel_data = $self->{pbot}->{messagehistory}->{database}->get_channel_data($account, $channel, 'validated'); if($channel_data->{validated} & $self->{NICKSERV_VALIDATED}) { $channel_data->{validated} &= ~$self->{NICKSERV_VALIDATED}; diff --git a/PBot/IRCHandlers.pm b/PBot/IRCHandlers.pm index b02e4d97..0e673d3c 100644 --- a/PBot/IRCHandlers.pm +++ b/PBot/IRCHandlers.pm @@ -217,18 +217,26 @@ sub on_kick { my ($message_account) = $self->{pbot}->{messagehistory}->{database}->find_message_account_by_nick($target); + my $hostmask; if(defined $message_account) { - my $hostmask = $self->{pbot}->{messagehistory}->{database}->find_most_recent_hostmask($message_account); + $hostmask = $self->{pbot}->{messagehistory}->{database}->find_most_recent_hostmask($message_account); my ($target_nick, $target_user, $target_host) = $hostmask =~ m/^([^!]+)!([^@]+)@(.*)/; my $text = "KICKED by $nick!$user\@$host ($reason)"; - $self->{pbot}->{messagehistory}->add_message($message_account, "$nick!$user\@$host", $channel, $text, $self->{pbot}->{messagehistory}->{MSG_DEPARTURE}); + $self->{pbot}->{messagehistory}->add_message($message_account, $hostmask, $channel, $text, $self->{pbot}->{messagehistory}->{MSG_DEPARTURE}); $self->{pbot}->{antiflood}->check_flood($channel, $target_nick, $target_user, $target_host, $text, $self->{pbot}->{registry}->get_value('antiflood', 'join_flood_threshold'), $self->{pbot}->{registry}->get_value('antiflood', 'join_flood_time_threshold'), $self->{pbot}->{messagehistory}->{MSG_DEPARTURE}); } + + $message_account = $self->{pbot}->{messagehistory}->{database}->get_message_account_id("$nick!$user\@$host"); + + if(defined $message_account) { + my $text = "KICKED " . (defined $hostmask ? $hostmask : $target) . " from $channel ($reason)"; + $self->{pbot}->{messagehistory}->add_message($message_account, "$nick!$user\@$host", $channel, $text, $self->{pbot}->{messagehistory}->{MSG_CHAT}); + } } sub on_departure { diff --git a/PBot/MessageHistory.pm b/PBot/MessageHistory.pm index 47b81007..acee9328 100644 --- a/PBot/MessageHistory.pm +++ b/PBot/MessageHistory.pm @@ -232,13 +232,13 @@ sub recall_message { my $ago = ago(gettimeofday - $message->{timestamp}); if(not defined $recall_text) { - if($text =~ s/^\/me\s+//) { + if($text =~ s/^\/me\s+// or $text =~ m/^KICKED /) { $recall_text = "[$ago] * $found_nick $text"; } else { $recall_text = "[$ago] <$found_nick> $text"; } } else { - if($text =~ s/^\/me\s+//) { + if($text =~ s/^\/me\s+// or $text =~ m/^KICKED /) { $recall_text .= " [$ago] * $found_nick $text"; } else { $recall_text .= " [$ago] <$found_nick> $text"; diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 7136aeea..1824213c 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,7 +13,7 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 792, + BUILD_REVISION => 793, BUILD_DATE => "2014-10-13", };