3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 04:19:27 +01:00

Fixed unban command; misc bug-fixes

This commit is contained in:
Pragmatic Software 2011-10-31 19:56:08 +00:00
parent 4a552e2935
commit df42b242e4
5 changed files with 10 additions and 10 deletions

View File

@ -70,7 +70,7 @@ sub get_baninfo {
$banmask =~ s/\\\*/.*?/g; $banmask =~ s/\\\*/.*?/g;
$banmask =~ s/\\\?/./g; $banmask =~ s/\\\?/./g;
if($mask =~ m/$banmask/i) { if($mask =~ m/^$banmask$/i) {
my $baninfo = {}; my $baninfo = {};
$baninfo->{banmask} = $banmask_key; $baninfo->{banmask} = $banmask_key;
$baninfo->{channel} = $channel; $baninfo->{channel} = $channel;

View File

@ -86,10 +86,8 @@ sub unban_user {
return "/msg $nick Usage for /msg: !unban $target <channel>" if $channel !~ /^#/; return "/msg $nick Usage for /msg: !unban $target <channel>" if $channel !~ /^#/;
$self->{pbot}->chanops->unban_user($arguments, $from); $self->{pbot}->chanops->unban_user($target, $channel);
delete $self->{pbot}->chanops->{unban_timeout}->hash->{$arguments}; return "/msg $nick $target has been unbanned from $channel.";
$self->{pbot}->chanops->{unban_timeout}->save_hash();
return "/msg $nick $arguments has been unbanned.";
} }
sub kick_user { sub kick_user {

View File

@ -91,6 +91,9 @@ sub ban_user {
sub unban_user { sub unban_user {
my $self = shift; my $self = shift;
my ($mask, $channel) = @_; 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"; unshift @{ $self->{op_commands} }, "mode $channel -b $mask";
$self->gain_ops($channel); $self->gain_ops($channel);
} }
@ -114,10 +117,7 @@ sub check_unban_timeouts {
foreach my $mask (keys %{ $self->{unban_timeout}->hash }) { foreach my $mask (keys %{ $self->{unban_timeout}->hash }) {
if($self->{unban_timeout}->hash->{$mask}{timeout} < $now) { 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}); $self->unban_user($mask, $self->{unban_timeout}->hash->{$mask}{channel});
delete $self->{unban_timeout}->hash->{$mask};
$self->{unban_timeout}->save_hash();
} else { } else {
#my $timediff = $unban_timeout{$mask}{timeout} - $now; #my $timediff = $unban_timeout{$mask}{timeout} - $now;
#$logger->log "ban: $mask has $timediff seconds remaining\n" #$logger->log "ban: $mask has $timediff seconds remaining\n"

View File

@ -1380,6 +1380,8 @@ sub sl_real {
if ($self->{_debug}) { if ($self->{_debug}) {
print ">>> $line\n"; print ">>> $line\n";
} }
return unless defined $self->socket;
# RFC compliance can be kinda nice... # RFC compliance can be kinda nice...
my $rv = $self->ssl ? my $rv = $self->ssl ?

View File

@ -13,8 +13,8 @@ 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 => 321, BUILD_REVISION => 322,
BUILD_DATE => "2011-02-17", BUILD_DATE => "2011-10-31",
}; };
1; 1;