mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 04:02:37 +01:00
Improve handling of KICK events wrt to message history
This commit is contained in:
parent
46fa0d52b3
commit
a679b0ff15
@ -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);
|
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}) {
|
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');
|
my $channel_data = $self->{pbot}->{messagehistory}->{database}->get_channel_data($account, $channel, 'validated');
|
||||||
if($channel_data->{validated} & $self->{NICKSERV_VALIDATED}) {
|
if($channel_data->{validated} & $self->{NICKSERV_VALIDATED}) {
|
||||||
$channel_data->{validated} &= ~$self->{NICKSERV_VALIDATED};
|
$channel_data->{validated} &= ~$self->{NICKSERV_VALIDATED};
|
||||||
|
@ -217,18 +217,26 @@ sub on_kick {
|
|||||||
|
|
||||||
my ($message_account) = $self->{pbot}->{messagehistory}->{database}->find_message_account_by_nick($target);
|
my ($message_account) = $self->{pbot}->{messagehistory}->{database}->find_message_account_by_nick($target);
|
||||||
|
|
||||||
|
my $hostmask;
|
||||||
if(defined $message_account) {
|
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 ($target_nick, $target_user, $target_host) = $hostmask =~ m/^([^!]+)!([^@]+)@(.*)/;
|
||||||
my $text = "KICKED by $nick!$user\@$host ($reason)";
|
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}->{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_threshold'),
|
||||||
$self->{pbot}->{registry}->get_value('antiflood', 'join_flood_time_threshold'),
|
$self->{pbot}->{registry}->get_value('antiflood', 'join_flood_time_threshold'),
|
||||||
$self->{pbot}->{messagehistory}->{MSG_DEPARTURE});
|
$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 {
|
sub on_departure {
|
||||||
|
@ -232,13 +232,13 @@ sub recall_message {
|
|||||||
my $ago = ago(gettimeofday - $message->{timestamp});
|
my $ago = ago(gettimeofday - $message->{timestamp});
|
||||||
|
|
||||||
if(not defined $recall_text) {
|
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";
|
$recall_text = "[$ago] * $found_nick $text";
|
||||||
} else {
|
} else {
|
||||||
$recall_text = "[$ago] <$found_nick> $text";
|
$recall_text = "[$ago] <$found_nick> $text";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if($text =~ s/^\/me\s+//) {
|
if($text =~ s/^\/me\s+// or $text =~ m/^KICKED /) {
|
||||||
$recall_text .= " [$ago] * $found_nick $text";
|
$recall_text .= " [$ago] * $found_nick $text";
|
||||||
} else {
|
} else {
|
||||||
$recall_text .= " [$ago] <$found_nick> $text";
|
$recall_text .= " [$ago] <$found_nick> $text";
|
||||||
|
@ -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 => 792,
|
BUILD_REVISION => 793,
|
||||||
BUILD_DATE => "2014-10-13",
|
BUILD_DATE => "2014-10-13",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user