From df42b242e47298994bd14a50f3a8edc1e97aea7e Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Mon, 31 Oct 2011 19:56:08 +0000 Subject: [PATCH] Fixed unban command; misc bug-fixes --- PBot/BanTracker.pm | 2 +- PBot/ChanOpCommands.pm | 6 ++---- PBot/ChanOps.pm | 6 +++--- PBot/IRC/Connection.pm | 2 ++ PBot/VERSION.pm | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/PBot/BanTracker.pm b/PBot/BanTracker.pm index 778177e1..69c47613 100644 --- a/PBot/BanTracker.pm +++ b/PBot/BanTracker.pm @@ -70,7 +70,7 @@ sub get_baninfo { $banmask =~ s/\\\*/.*?/g; $banmask =~ s/\\\?/./g; - if($mask =~ m/$banmask/i) { + if($mask =~ m/^$banmask$/i) { my $baninfo = {}; $baninfo->{banmask} = $banmask_key; $baninfo->{channel} = $channel; diff --git a/PBot/ChanOpCommands.pm b/PBot/ChanOpCommands.pm index c9b2e9c2..39bb1a1b 100644 --- a/PBot/ChanOpCommands.pm +++ b/PBot/ChanOpCommands.pm @@ -86,10 +86,8 @@ sub unban_user { return "/msg $nick Usage for /msg: !unban $target " if $channel !~ /^#/; - $self->{pbot}->chanops->unban_user($arguments, $from); - delete $self->{pbot}->chanops->{unban_timeout}->hash->{$arguments}; - $self->{pbot}->chanops->{unban_timeout}->save_hash(); - return "/msg $nick $arguments has been unbanned."; + $self->{pbot}->chanops->unban_user($target, $channel); + return "/msg $nick $target has been unbanned from $channel."; } sub kick_user { diff --git a/PBot/ChanOps.pm b/PBot/ChanOps.pm index cca0e6d3..6b448a95 100644 --- a/PBot/ChanOps.pm +++ b/PBot/ChanOps.pm @@ -91,6 +91,9 @@ sub ban_user { sub unban_user { my $self = shift; my ($mask, $channel) = @_; + $self->{pbot}->logger->log("Unbanning $mask\n"); + delete $self->{unban_timeout}->hash->{$mask}; + $self->{unban_timeout}->save_hash(); unshift @{ $self->{op_commands} }, "mode $channel -b $mask"; $self->gain_ops($channel); } @@ -114,10 +117,7 @@ sub check_unban_timeouts { foreach my $mask (keys %{ $self->{unban_timeout}->hash }) { if($self->{unban_timeout}->hash->{$mask}{timeout} < $now) { - $self->{pbot}->logger->log("Unbanning $mask\n"); $self->unban_user($mask, $self->{unban_timeout}->hash->{$mask}{channel}); - delete $self->{unban_timeout}->hash->{$mask}; - $self->{unban_timeout}->save_hash(); } else { #my $timediff = $unban_timeout{$mask}{timeout} - $now; #$logger->log "ban: $mask has $timediff seconds remaining\n" diff --git a/PBot/IRC/Connection.pm b/PBot/IRC/Connection.pm index 1eb75405..105d8646 100644 --- a/PBot/IRC/Connection.pm +++ b/PBot/IRC/Connection.pm @@ -1380,6 +1380,8 @@ sub sl_real { if ($self->{_debug}) { print ">>> $line\n"; } + + return unless defined $self->socket; # RFC compliance can be kinda nice... my $rv = $self->ssl ? diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 1cade59f..9067ba5d 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,8 +13,8 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 321, - BUILD_DATE => "2011-02-17", + BUILD_REVISION => 322, + BUILD_DATE => "2011-10-31", }; 1;