mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 02:49:49 +01:00
ChanOps: dequeue existing identical ban/mute timeouts when adding/updating timeout
This commit is contained in:
parent
7ce2eb87d2
commit
dde93db0ac
@ -486,15 +486,17 @@ sub mute_user {
|
|||||||
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
||||||
my ($target, $channel, $length) = $self->{pbot}->{interpreter}->split_args($stuff->{arglist}, 3);
|
my ($target, $channel, $length) = $self->{pbot}->{interpreter}->split_args($stuff->{arglist}, 3);
|
||||||
|
|
||||||
|
$channel = '' if not defined $channel;
|
||||||
|
|
||||||
if (not defined $from) {
|
if (not defined $from) {
|
||||||
$self->{pbot}->{logger}->log("Command missing ~from parameter!\n");
|
$self->{pbot}->{logger}->log("Command missing ~from parameter!\n");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not defined $channel and $from !~ m/^#/) { return "Usage from private message: mute <mask> <channel> [timeout (default: 24 hours)]"; }
|
if (not length $channel and $from !~ m/^#/) { return "Usage from private message: mute <mask> <channel> [timeout (default: 24 hours)]"; }
|
||||||
|
|
||||||
if ($channel !~ m/^#/) {
|
if ($channel !~ m/^#/) {
|
||||||
$length = "$channel $length";
|
$length = $channel . ' ' . (defined $length ? $length : '');
|
||||||
$length = undef if $length eq ' ';
|
$length = undef if $length eq ' ';
|
||||||
$channel = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $from;
|
$channel = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $from;
|
||||||
}
|
}
|
||||||
|
@ -224,6 +224,8 @@ sub ban_user_timed {
|
|||||||
$data->{reason} = $reason if defined $reason;
|
$data->{reason} = $reason if defined $reason;
|
||||||
$self->{unban_timeout}->add($channel, $mask, $data);
|
$self->{unban_timeout}->add($channel, $mask, $data);
|
||||||
|
|
||||||
|
$self->{pbot}->{timer}->dequeue_event("unban_timeout $channel $mask");
|
||||||
|
|
||||||
if ($length > 0) {
|
if ($length > 0) {
|
||||||
$self->enqueue_unban_timeout($channel, $mask, $length);
|
$self->enqueue_unban_timeout($channel, $mask, $length);
|
||||||
}
|
}
|
||||||
@ -278,6 +280,8 @@ sub mute_user_timed {
|
|||||||
$data->{reason} = $reason if defined $reason;
|
$data->{reason} = $reason if defined $reason;
|
||||||
$self->{unmute_timeout}->add($channel, $mask, $data);
|
$self->{unmute_timeout}->add($channel, $mask, $data);
|
||||||
|
|
||||||
|
$self->{pbot}->{timer}->dequeue_event("unmute_timeout $channel $mask");
|
||||||
|
|
||||||
if ($length > 0) {
|
if ($length > 0) {
|
||||||
$self->enqueue_unmute_timeout($channel, $mask, $length);
|
$self->enqueue_unmute_timeout($channel, $mask, $length);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user