is_naughty is a setter now too

This commit is contained in:
Matt Simerson 2013-04-29 23:49:22 -04:00
parent 4c0632e043
commit 247c5a2bea
4 changed files with 12 additions and 9 deletions

View File

@ -307,7 +307,12 @@ sub is_immune {
}
sub is_naughty {
my $self = shift;
my ($self, $setit) = @_;
if ( defined $setit ) {
$self->connection->notes('naughty', $setit);
$self->connection->notes('rejected', $setit);
};
if ($self->connection->notes('naughty')) {

View File

@ -294,7 +294,7 @@ sub hook_rcpt {
"skip, don't blacklist special account: " . $rcpt->user);
# clear the naughty connection note here, if desired.
$self->connection->notes('naughty', 0);
$self->is_naughty(0);
}
return DECLINED;

View File

@ -661,9 +661,7 @@ sub autolearn_naughty {
return;
}
if ( $self->connection->notes('naughty')
&& $response->{result} eq 'Innocent')
{
if ( $self->is_naughty() && $response->{result} eq 'Innocent') {
$self->log(LOGINFO, "training naughty FN message as spam");
$self->train_error_as_spam($transaction);
return 1;
@ -707,7 +705,7 @@ sub autolearn_spamassassin {
my $sa = $transaction->notes('spamassassin');
if (!$sa || !$sa->{is_spam}) {
if (!$self->connection->notes('naughty')) {
if (!$self->is_naughty()) {
$self->log(LOGERROR, "SA results missing"); # SA skips naughty
}
return;

View File

@ -167,7 +167,7 @@ sub data_post_handler {
if ($found) {
$self->log(LOGNOTICE, "fail, found virus $found");
$self->connection->notes('naughty', 1); # see plugins/naughty
$self->is_naughty(1); # see plugins/naughty
$self->adjust_karma(-1);
if ($self->{_args}{deny_viruses}) {