3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-22 18:52:40 +01:00

prune_message_history used old flood_watch instead of message_history -- fixed

This commit is contained in:
Pragmatic Software 2010-03-29 08:39:48 +00:00
parent aaa6b2782d
commit f5bfe2dfda

View File

@ -124,16 +124,16 @@ sub prune_message_history {
my $self = shift; my $self = shift;
$self->{pbot}->logger->log("Pruning message history . . .\n"); $self->{pbot}->logger->log("Pruning message history . . .\n");
foreach my $nick (keys %{ $self->{flood_watch} }) { foreach my $nick (keys %{ $self->{message_history} }) {
foreach my $channel (keys %{ $self->{flood_watch}->{$nick} }) foreach my $channel (keys %{ $self->{message_history}->{$nick} })
{ {
$self->{pbot}->logger->log("Checking [$nick][$channel]\n"); $self->{pbot}->logger->log("Checking [$nick][$channel]\n");
my $length = $#{ $self->{flood_watch}->{$nick}{$channel}{messages} } + 1; my $length = $#{ $self->{message_history}->{$nick}{$channel}{messages} } + 1;
my %last = %{ @{ $self->{flood_watch}->{$nick}{$channel}{messages} }[$length - 1] }; my %last = %{ @{ $self->{message_history}->{$nick}{$channel}{messages} }[$length - 1] };
if(gettimeofday - $last{timestamp} >= 60 * 60 * 24) { if(gettimeofday - $last{timestamp} >= 60 * 60 * 24) {
$self->{pbot}->logger->log("$nick in $channel hasn't spoken in 24 hours, removing message history.\n"); $self->{pbot}->logger->log("$nick in $channel hasn't spoken in 24 hours, removing message history.\n");
delete $self->{flood_watch}->{$nick}{$channel}; delete $self->{message_history}->{$nick}{$channel};
} }
} }
} }