3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 04:19:27 +01:00

Automatically unmute +q'd offenders after mute_timeout (7 days)

This commit is contained in:
Pragmatic Software 2015-05-27 10:46:30 -07:00
parent b98ef02b6f
commit d0ebf98441
2 changed files with 9 additions and 0 deletions

View File

@ -35,6 +35,7 @@ sub initialize {
$self->{banlist} = {};
$self->{pbot}->{registry}->add_default('text', 'bantracker', 'chanserv_ban_timeout', '604800');
$self->{pbot}->{registry}->add_default('text', 'bantracker', 'mute_timeout', '604800');
$self->{pbot}->{registry}->add_default('text', 'bantracker', 'debug', '0');
$self->{pbot}->{commands}->register(sub { $self->dumpbans(@_) }, "dumpbans", 60);

View File

@ -203,6 +203,14 @@ sub on_mode {
}
}
}
elsif($mode eq "+q") {
if($nick ne $event->{conn}->nick) {
if (exists $self->{pbot}->{channels}->{channels}->hash->{$channel} and $self->{pbot}->{channels}->{channels}->hash->{$channel}{chanop}) {
$self->{pbot}->{chanops}->{unmute_timeout}->hash->{$channel}->{$target}{timeout} = gettimeofday + $self->{pbot}->{registry}->get_value('bantracker', 'mute_timeout');
$self->{pbot}->{chanops}->{unmute_timeout}->save;
}
}
}
elsif($mode eq "+e" && $channel eq $event->{conn}->nick) {
foreach my $chan (keys %{ $self->{pbot}->{channels}->{channels}->hash }) {
if($self->{channels}->{channels}->hash->{$chan}{enabled}) {