3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-22 20:09:43 +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;
if($mask =~ m/$banmask/i) {
if($mask =~ m/^$banmask$/i) {
my $baninfo = {};
$baninfo->{banmask} = $banmask_key;
$baninfo->{channel} = $channel;

View File

@ -86,10 +86,8 @@ sub unban_user {
return "/msg $nick Usage for /msg: !unban $target <channel>" 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 {

View File

@ -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"

View File

@ -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 ?

View File

@ -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;