mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01:00
Detect and handle KICK events
This commit is contained in:
parent
f8fc04f6e5
commit
1f242aeec4
@ -211,7 +211,7 @@ sub check_flood {
|
||||
# check for ban evasion if channel begins with # (not private message) and hasn't yet been validated against ban evasion
|
||||
if($channel =~ m/^#/ and not $self->{pbot}->{messagehistory}->{database}->get_channel_data($account, $channel, 'validated')->{'validated'} & $self->{NICKSERV_VALIDATED}) {
|
||||
if($mode == $self->{pbot}->{messagehistory}->{MSG_DEPARTURE}) {
|
||||
# don't check for evasion on PARTs
|
||||
# don't check for evasion on PART/KICK
|
||||
} else {
|
||||
$self->{pbot}->conn->whois($nick);
|
||||
$self->check_bans($account, $mask, $channel);
|
||||
|
@ -188,6 +188,25 @@ sub on_join {
|
||||
$self->{pbot}->antiflood->check_flood($channel, $nick, $user, $host, "JOIN", 4, 60 * 30, $self->{pbot}->{messagehistory}->{MSG_JOIN});
|
||||
}
|
||||
|
||||
sub on_kick {
|
||||
my ($self, $conn, $event) = @_;
|
||||
my ($nick, $user, $host, $target, $channel, $reason) = ($event->nick, $event->user, $event->host, $event->to, $event->{args}[0], $event->{args}[1]);
|
||||
|
||||
$self->{pbot}->logger->log("$nick!$user\@$host kicked $target from $channel ($reason)\n");
|
||||
|
||||
my ($message_account) = $self->{pbot}->{messagehistory}->{database}->find_message_account_by_nick($target);
|
||||
|
||||
if(defined $message_account) {
|
||||
my $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}->antiflood->check_flood($channel, $target_nick, $target_user, $target_host, $text, 4, 60 * 30, $self->{pbot}->{messagehistory}->{MSG_DEPARTURE});
|
||||
}
|
||||
}
|
||||
|
||||
sub on_departure {
|
||||
my ($self, $conn, $event) = @_;
|
||||
my ($nick, $user, $host, $channel, $args) = ($event->nick, $event->user, $event->host, $event->to, $event->args);
|
||||
|
@ -201,6 +201,7 @@ sub connect {
|
||||
$self->conn->add_handler('mode' , sub { $self->irchandlers->on_mode(@_) });
|
||||
$self->conn->add_handler('part' , sub { $self->irchandlers->on_departure(@_) });
|
||||
$self->conn->add_handler('join' , sub { $self->irchandlers->on_join(@_) });
|
||||
$self->conn->add_handler('kick' , sub { $self->irchandlers->on_kick(@_) });
|
||||
$self->conn->add_handler('quit' , sub { $self->irchandlers->on_departure(@_) });
|
||||
$self->conn->add_handler('pong' , sub { $self->lagchecker->on_pong(@_) });
|
||||
$self->conn->add_handler('whoisaccount' , sub { $self->antiflood->on_whoisaccount(@_) });
|
||||
|
@ -13,8 +13,8 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 574,
|
||||
BUILD_DATE => "2014-05-14",
|
||||
BUILD_REVISION => 575,
|
||||
BUILD_DATE => "2014-05-15",
|
||||
};
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user