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

Fix scalar keys thing

This commit is contained in:
Pragmatic Software 2017-10-09 19:40:32 -07:00
parent 7e76740f5b
commit 240b4a6df0

View File

@ -78,12 +78,12 @@ sub adjust_offenses {
my $self = shift;
my $now = gettimeofday;
foreach my $channel (keys $self->{offenses}) {
foreach my $nick (keys $self->{offenses}->{$channel}) {
foreach my $channel (keys %{ $self->{offenses} }) {
foreach my $nick (keys %{ $self->{offenses}->{$channel} }) {
if ($now - $self->{offenses}->{$channel}->{$nick}->{time} >= 60 * 60 * 24 * 7) {
if (--$self->{offenses}->{$channel}->{$nick}->{offenses} <= 0) {
delete $self->{offenses}->{$channel}->{$nick};
delete $self->{offenses}->{$channel} if not keys $self->{offenses}->{$channel};
delete $self->{offenses}->{$channel} if not keys %{ $self->{offenses}->{$channel} };
}
}
}