mirror of
https://github.com/pragma-/pbot.git
synced 2025-02-02 15:34:05 +01:00
ChanOps: Don't attempt to gain ops for disabled channels
This commit is contained in:
parent
a927ee27a2
commit
a599a78444
@ -67,7 +67,9 @@ sub initialize {
|
||||
sub can_gain_ops {
|
||||
my ($self, $channel) = @_;
|
||||
$channel = lc $channel;
|
||||
return exists $self->{pbot}->{channels}->{channels}->hash->{$channel} && $self->{pbot}->{channels}->{channels}->hash->{$channel}{chanop};
|
||||
return exists $self->{pbot}->{channels}->{channels}->hash->{$channel}
|
||||
&& $self->{pbot}->{channels}->{channels}->hash->{$channel}{chanop}
|
||||
&& $self->{pbot}->{channels}->{channels}->hash->{$channel}{enabled};
|
||||
}
|
||||
|
||||
sub gain_ops {
|
||||
@ -464,9 +466,15 @@ sub check_opped_timeouts {
|
||||
|
||||
foreach my $channel (keys %{ $self->{op_requested} }) {
|
||||
if ($now - $self->{op_requested}->{$channel} > 60 * 5) {
|
||||
$self->{pbot}->{logger}->log("5 minutes since OP request for $channel and no OP yet; trying again ...\n");
|
||||
delete $self->{op_requested}->{$channel};
|
||||
$self->gain_ops($channel);
|
||||
if (exists $self->{pbot}->{channels}->{channels}->hash->{$channel}
|
||||
and $self->{pbot}->{channels}->{channels}->hash->{$channel}{enabled}) {
|
||||
$self->{pbot}->{logger}->log("5 minutes since OP request for $channel and no OP yet; trying again ...\n");
|
||||
delete $self->{op_requested}->{$channel};
|
||||
$self->gain_ops($channel);
|
||||
} else {
|
||||
$self->{pbot}->{logger}->log("Disregarding OP request for $channel (channel is disabled)\n");
|
||||
delete $self->{op_requested}->{$channel};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user