spamassassin: assign karma for autolearn message

also removed 'use lib', to be consistent with most other plugins
and improved grammar
This commit is contained in:
Matt Simerson 2013-03-23 01:24:02 -04:00
parent 8012dff4f9
commit c0899f6d4d

View File

@ -134,7 +134,7 @@ Make the "subject munge string" configurable
* added support for per-user SpamAssassin preferences * added support for per-user SpamAssassin preferences
* updated get_spam_results so that score=N.N works (as well as hits=N.N) * updated get_spam_results so that score=N.N works (as well as hits=N.N)
* rewrote the X-Spam-* header additions so that SA generated headers are * rewrote the X-Spam-* header additions so that SA generated headers are
not discarded. Admin can alter SA headers with add_header in their SA preserved. Admins can alter SA headers with add_header in their SA
config. Subverting their changes there is unexpected. Making them read config. Subverting their changes there is unexpected. Making them read
code to figure out why is an unnecessary hurdle. code to figure out why is an unnecessary hurdle.
* added assemble_message, so we can calc content size which spamd wants * added assemble_message, so we can calc content size which spamd wants
@ -144,7 +144,6 @@ Make the "subject munge string" configurable
use strict; use strict;
use warnings; use warnings;
use lib 'lib';
use Qpsmtpd::Constants; use Qpsmtpd::Constants;
use Qpsmtpd::DSN; use Qpsmtpd::DSN;
@ -398,6 +397,8 @@ sub reject {
my $status = "$ham_or_spam, $score"; my $status = "$ham_or_spam, $score";
my $learn = ''; my $learn = '';
if ( $sa_results->{autolearn} ) { if ( $sa_results->{autolearn} ) {
$self->adjust_karma( 1 ) if $ham_or_spam eq 'Ham';
$self->adjust_karma( -1 ) if $ham_or_spam eq 'Spam';
$learn = "learn=". $sa_results->{autolearn}; $learn = "learn=". $sa_results->{autolearn};
}; };
@ -417,8 +418,6 @@ sub reject {
} }
} }
$self->adjust_karma( -1 );
# default of media_unsupported is DENY, so just change the message
$self->log(LOGINFO, "fail, $status, > $reject, $learn"); $self->log(LOGINFO, "fail, $status, > $reject, $learn");
return ($self->get_reject_type(), "spam score exceeded threshold"); return ($self->get_reject_type(), "spam score exceeded threshold");
} }
@ -477,7 +476,7 @@ sub parse_spam_header {
} }
$r{is_spam} = $is_spam; $r{is_spam} = $is_spam;
# backwards compatibility for SA versions < 3 # compatibility for SA versions < 3
if ( defined $r{hits} && ! defined $r{score} ) { if ( defined $r{hits} && ! defined $r{score} ) {
$r{score} = delete $r{hits}; $r{score} = delete $r{hits};
}; };