diff --git a/PBot/MessageHistory.pm b/PBot/MessageHistory.pm index 1657bb86..242265de 100644 --- a/PBot/MessageHistory.pm +++ b/PBot/MessageHistory.pm @@ -44,7 +44,8 @@ sub initialize { $self->{MSG_DEPARTURE} = 2; # PART, QUIT, KICK $self->{MSG_NICKCHANGE} = 3; # CHANGED NICK - $self->{pbot}->{registry}->add_default('text', 'messagehistory', 'max_recall_time', $conf{max_recall_time} // undef); + $self->{pbot}->{registry}->add_default('text', 'messagehistory', 'max_recall_time', $conf{max_recall_time} // 0); + $self->{pbot}->{registry}->add_default('text', 'messagehistory', 'max_messages', 32); $self->{pbot}->{commands}->register(sub { $self->recall_message(@_) }, "recall", 0); $self->{pbot}->{commands}->register(sub { $self->list_also_known_as(@_) }, "aka", 0); @@ -368,7 +369,7 @@ sub recall_message { foreach my $msg (@$messages) { $self->{pbot}->{logger}->log("$nick ($from) recalled <$msg->{nick}/$msg->{channel}> $msg->{msg}\n"); - if (defined $max_recall_time && gettimeofday - $msg->{timestamp} > $max_recall_time && not $self->{pbot}->{admins}->loggedin($from, "$nick!$user\@$host")) { + if ($max_recall_time && gettimeofday - $msg->{timestamp} > $max_recall_time && not $self->{pbot}->{admins}->loggedin($from, "$nick!$user\@$host")) { $max_recall_time = duration($max_recall_time); $recall_text .= "Sorry, you can not recall messages older than $max_recall_time."; return $recall_text;