mirror of https://github.com/pragma-/pbot.git
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 {
|
sub can_gain_ops {
|
||||||
my ($self, $channel) = @_;
|
my ($self, $channel) = @_;
|
||||||
$channel = lc $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 {
|
sub gain_ops {
|
||||||
|
@ -464,9 +466,15 @@ sub check_opped_timeouts {
|
||||||
|
|
||||||
foreach my $channel (keys %{ $self->{op_requested} }) {
|
foreach my $channel (keys %{ $self->{op_requested} }) {
|
||||||
if ($now - $self->{op_requested}->{$channel} > 60 * 5) {
|
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");
|
if (exists $self->{pbot}->{channels}->{channels}->hash->{$channel}
|
||||||
delete $self->{op_requested}->{$channel};
|
and $self->{pbot}->{channels}->{channels}->hash->{$channel}{enabled}) {
|
||||||
$self->gain_ops($channel);
|
$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