diff --git a/PBot/ChanOpCommands.pm b/PBot/ChanOpCommands.pm index 50e6f5af..fb21efb5 100644 --- a/PBot/ChanOpCommands.pm +++ b/PBot/ChanOpCommands.pm @@ -486,15 +486,17 @@ sub mute_user { my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_; my ($target, $channel, $length) = $self->{pbot}->{interpreter}->split_args($stuff->{arglist}, 3); + $channel = '' if not defined $channel; + if (not defined $from) { $self->{pbot}->{logger}->log("Command missing ~from parameter!\n"); return ""; } - if (not defined $channel and $from !~ m/^#/) { return "Usage from private message: mute [timeout (default: 24 hours)]"; } + if (not length $channel and $from !~ m/^#/) { return "Usage from private message: mute [timeout (default: 24 hours)]"; } if ($channel !~ m/^#/) { - $length = "$channel $length"; + $length = $channel . ' ' . (defined $length ? $length : ''); $length = undef if $length eq ' '; $channel = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $from; } diff --git a/PBot/ChanOps.pm b/PBot/ChanOps.pm index f237a4c1..8587ed71 100644 --- a/PBot/ChanOps.pm +++ b/PBot/ChanOps.pm @@ -224,6 +224,8 @@ sub ban_user_timed { $data->{reason} = $reason if defined $reason; $self->{unban_timeout}->add($channel, $mask, $data); + $self->{pbot}->{timer}->dequeue_event("unban_timeout $channel $mask"); + if ($length > 0) { $self->enqueue_unban_timeout($channel, $mask, $length); } @@ -278,6 +280,8 @@ sub mute_user_timed { $data->{reason} = $reason if defined $reason; $self->{unmute_timeout}->add($channel, $mask, $data); + $self->{pbot}->{timer}->dequeue_event("unmute_timeout $channel $mask"); + if ($length > 0) { $self->enqueue_unmute_timeout($channel, $mask, $length); }