is_naughty is a setter now too

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

View File

@ -307,7 +307,12 @@ sub is_immune {
} }
sub is_naughty { 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')) { if ($self->connection->notes('naughty')) {

View File

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

View File

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

View File

@ -92,8 +92,8 @@ adjusted for ClamAV::Client by Devin Carraway <qpsmtpd/@/devin.com>.
=head1 COPYRIGHT AND LICENSE =head1 COPYRIGHT AND LICENSE
Copyright (c) 2005 John Peacock, Copyright (c) 2005 John Peacock,
Copyright (c) 2007 Devin Carraway Copyright (c) 2007 Devin Carraway
Based heavily on the clamav plugin Based heavily on the clamav plugin
@ -167,7 +167,7 @@ sub data_post_handler {
if ($found) { if ($found) {
$self->log(LOGNOTICE, "fail, found virus $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); $self->adjust_karma(-1);
if ($self->{_args}{deny_viruses}) { if ($self->{_args}{deny_viruses}) {