3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-24 19:52:34 +01:00

No need to WHOIS on joins if extended-join is available

This commit is contained in:
Pragmatic Software 2016-08-29 20:47:46 -07:00
parent ca349804ca
commit d07458425f

View File

@ -270,7 +270,7 @@ sub update_join_watch {
} }
} }
# check QUIT message for Ping timeout or Excess Flood # check QUIT message for Ping timeout or Excess Flood
elsif($text =~ /^QUIT Ping timeout/ or $text =~ /^QUIT Excess Flood/) { elsif($text =~ /^QUIT Ping timeout/ or $text =~ /^QUIT Excess Flood/ or $text =~ /^QUIT Max SendQ exceeded/) {
# treat these as an extra join so they're snagged more quickly since these usually will keep flooding # treat these as an extra join so they're snagged more quickly since these usually will keep flooding
$channel_data->{join_watch}++; $channel_data->{join_watch}++;
$self->{pbot}->{messagehistory}->{database}->update_channel_data($account, $channel, $channel_data); $self->{pbot}->{messagehistory}->{database}->update_channel_data($account, $channel, $channel_data);
@ -409,10 +409,14 @@ sub check_flood {
$self->{whois_pending}->{$nick} = gettimeofday; $self->{whois_pending}->{$nick} = gettimeofday;
} }
} else { } else {
if (not exists $self->{whois_pending}->{$nick}) { if ($mode == $self->{pbot}->{messagehistory}->{MSG_JOIN} && exists $self->{pbot}->{capabilities}->{'extended-join'}) {
$self->{pbot}->{messagehistory}->{database}->set_current_nickserv_account($account, ''); # don't WHOIS joins if extended-join capability is active
$self->{pbot}->{conn}->whois($nick); } else {
$self->{whois_pending}->{$nick} = gettimeofday; if (not exists $self->{whois_pending}->{$nick}) {
$self->{pbot}->{messagehistory}->{database}->set_current_nickserv_account($account, '');
$self->{pbot}->{conn}->whois($nick);
$self->{whois_pending}->{$nick} = gettimeofday;
}
} }
} }
} }
@ -746,10 +750,10 @@ sub check_bans {
my $debug_checkban = $self->{pbot}->{registry}->get_value('antiflood', 'debug_checkban'); my $debug_checkban = $self->{pbot}->{registry}->get_value('antiflood', 'debug_checkban');
$self->{pbot}->{logger}->log("anti-flood: [check-bans] checking for bans on $mask in $channel\n") if $debug_checkban >= 1;
my $current_nickserv_account = $self->{pbot}->{messagehistory}->{database}->get_current_nickserv_account($message_account); my $current_nickserv_account = $self->{pbot}->{messagehistory}->{database}->get_current_nickserv_account($message_account);
$self->{pbot}->{logger}->log("anti-flood: [check-bans] checking for bans on $mask " . (defined $current_nickserv_account and length $current_nickserv_account ? "[$current_nickserv_account] " : "") . "in $channel\n");
if (defined $current_nickserv_account and length $current_nickserv_account) { if (defined $current_nickserv_account and length $current_nickserv_account) {
$self->{pbot}->{logger}->log("anti-flood: [check-bans] current nickserv [$current_nickserv_account] found for $mask\n") if $debug_checkban >= 2; $self->{pbot}->{logger}->log("anti-flood: [check-bans] current nickserv [$current_nickserv_account] found for $mask\n") if $debug_checkban >= 2;
my $channel_data = $self->{pbot}->{messagehistory}->{database}->get_channel_data($message_account, $channel, 'validated'); my $channel_data = $self->{pbot}->{messagehistory}->{database}->get_channel_data($message_account, $channel, 'validated');