3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

Fix splitting of IPv6 masks in modes in IRC/Connection.pm

Include channel in "Unbanning ..." message in unban_user
Set target_nickserv_account if accounts match in check_bans
This commit is contained in:
Pragmatic Software 2013-07-30 09:50:59 +00:00
parent 7f2cefea7a
commit 2509bcec64
4 changed files with 23 additions and 5 deletions

View File

@ -504,18 +504,19 @@ sub check_bans {
foreach my $account (keys %{ $self->{message_history} }) {
if(exists $self->{message_history}->{$account}->{channels}->{$channel}) {
my $check_ban = 0;
my $target_nickserv_account;
# check if nickserv accounts match
if(defined $nickserv_account) {
if(exists $self->{message_history}->{$account}->{nickserv_account} and $self->{message_history}->{$account}->{nickserv_account} eq $nickserv_account) {
$self->{pbot}->logger->log("anti-flood: [check-bans] nickserv account for $account matches $nickserv_account\n");
$target_nickserv_account = $self->{message_history}->{$account}->{nickserv_account};
$check_ban = 1;
}
}
# check if hosts match
my ($account_host) = $account =~ m/\@(.*)$/;
my $target_nickserv_account;
if($host eq $account_host) {
$self->{pbot}->logger->log("anti-flood: [check-bans] host for $account matches $mask\n");

View File

@ -90,7 +90,7 @@ sub ban_user {
sub unban_user {
my $self = shift;
my ($mask, $channel) = @_;
$self->{pbot}->logger->log("Unbanning $mask\n");
$self->{pbot}->logger->log("Unbanning $channel $mask\n");
if($self->{unban_timeout}->find_index($channel, $mask)) {
$self->{unban_timeout}->hash->{$channel}->{$mask}{timeout} = gettimeofday + 7200; # try again in 2 hours if unban doesn't immediately succeed
$self->{unban_timeout}->save;

View File

@ -500,6 +500,12 @@ sub handler {
}
print "Trying to handle event '$ev'.\n" if $self->{_debug};
if($self->{_debug}) {
use Data::Dumper;
print "ev: ", Dumper($ev), "\nevent: ", Dumper($event), "\n";
}
my $handler = undef;
if (exists $self->{_handler}->{$ev}) {
@ -928,11 +934,22 @@ sub parse {
# Fixes problems with IPv6 hostnames.
# ($from, $line) = split ":", $line, 2;
($from, $line) = $line =~ /^(?:|)(\S+\s+[^:]+):?(.*)/;
print "from: [$from], line: [$line]\n" if $self->{_debug};
($from, $type, @stuff) = split /\s+/, $from;
$type = lc $type;
# fix splitting of IPv6 hostnames in modes -- pragma- 2013/07/30
if($type eq "mode" and $#stuff > -1) {
my @other_stuff = split /\s+/, $line;
$stuff[$#stuff] .= ':' . shift @other_stuff;
push @stuff, @other_stuff;
$line = "";
}
# This should be fairly intuitive... (cperl-mode sucks, though)
if (defined $line and index($line, "\001") >= 0) {
$itype = "ctcp";
unless ($type eq "notice") {

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 414,
BUILD_DATE => "2013-07-28",
BUILD_REVISION => 415,
BUILD_DATE => "2013-07-30",
};
1;