X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FLog%2FSpam.pm;h=e5ed18f1c8f4441890f62b8a134797807313a315;hb=466f7faff129a5699c7674f59900a92aa256175d;hp=2dcb45adabfc0e27ea024638e045f664c2260aba;hpb=2323525ed25f8260646ef7253b56fdabe1c98ff5;p=debbugs.git diff --git a/Debbugs/Log/Spam.pm b/Debbugs/Log/Spam.pm index 2dcb45a..e5ed18f 100644 --- a/Debbugs/Log/Spam.pm +++ b/Debbugs/Log/Spam.pm @@ -149,7 +149,7 @@ sub _init { =item save -$self->save(); +C<$spam_log->save();> Saves changes to the bug log spam file. @@ -164,15 +164,15 @@ sub save { binmode($fh,':encoding(UTF-8)'); for my $msgid (keys %{$self->{spam}}) { # was this message set to spam/ham by .d? If so, don't save it - if ($self->{spam} ne '0' and - $self->{spam} ne '1') { + if ($self->{spam}{$msgid} ne '0' and + $self->{spam}{$msgid} ne '1') { next; } print {$fh} $msgid; - if ($self->{spam} eq '0') { + if ($self->{spam}{$msgid} eq '0') { print {$fh} ' ham'; } - print {$fh "\n"; + print {$fh} "\n"; } close($fh) or croak "Unable to write to '$self->{name}.tmp': $!"; rename($self->{name}.'.tmp',$self->{name}); @@ -181,7 +181,7 @@ sub save { =item is_spam - next if ($spam_log->is_spam('12456@exmaple.com')); +Cis_spam('12456@exmaple.com'));> Returns 1 if this message id confirms that the message is spam @@ -228,7 +228,7 @@ sub is_ham { Add a message id to the spam listing. -You must call C<$self->save()> if you wish the changes to be written out to disk. +You must call C<$spam_log->save()> if you wish the changes to be written out to disk. =cut @@ -244,16 +244,26 @@ sub add_spam { Add a message id to the ham listing. -You must call C<$self->save()> if you wish the changes to be written out to disk. +You must call C<$spam_log->save()> if you wish the changes to be written out to disk. =cut -sub add_spam { +sub add_ham { my ($self,$msgid) = @_; $msgid =~ s/^<|>$//; $self->{spam}{$msgid} = '0'; } +=item remove_message + + $spam_log->remove_message('123456@example.com'); + +Remove a message from the spam/ham listing. + +You must call C<$spam_log->save()> if you wish the changes to be written out to disk. + +=cut + 1;