From c0899f6d4dbc48b3f6e3702591c06b2a2efdd633 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Sat, 23 Mar 2013 01:24:02 -0400 Subject: [PATCH] spamassassin: assign karma for autolearn message also removed 'use lib', to be consistent with most other plugins and improved grammar --- plugins/spamassassin | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/spamassassin b/plugins/spamassassin index be5c2ef..1279681 100644 --- a/plugins/spamassassin +++ b/plugins/spamassassin @@ -134,7 +134,7 @@ Make the "subject munge string" configurable * added support for per-user SpamAssassin preferences * 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 - 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 code to figure out why is an unnecessary hurdle. * 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 warnings; -use lib 'lib'; use Qpsmtpd::Constants; use Qpsmtpd::DSN; @@ -398,6 +397,8 @@ sub reject { my $status = "$ham_or_spam, $score"; my $learn = ''; 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}; }; @@ -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"); return ($self->get_reject_type(), "spam score exceeded threshold"); } @@ -477,7 +476,7 @@ sub parse_spam_header { } $r{is_spam} = $is_spam; - # backwards compatibility for SA versions < 3 + # compatibility for SA versions < 3 if ( defined $r{hits} && ! defined $r{score} ) { $r{score} = delete $r{hits}; };