From bb03a785ef470974b4bad31377dc6928933c3836 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Thu, 15 May 2014 12:21:09 +0000 Subject: [PATCH 1/2] munge_subject_threshold did not previously work --- plugins/spamassassin | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/spamassassin b/plugins/spamassassin index 342c788..e5f0310 100644 --- a/plugins/spamassassin +++ b/plugins/spamassassin @@ -444,12 +444,14 @@ sub munge_subject { my $sa = $self->get_spam_results($transaction) or return; my $qp_num = $self->{_args}{munge_subject_threshold}; + my $required = $sa->{required}; - my $required = $sa->{required} || $qp_num or do { + if (!$qp_num) { $self->log(LOGDEBUG, "skipping munge, no user or qpsmtpd pref set"); return; }; return unless $sa->{score} > $required; + return unless $sa->{score} > $qp_num; my $subject_prefix = $self->qp->config('subject_prefix') || '*** SPAM ***'; my $subject = $transaction->header->get('Subject') || ''; From bef79d3b7d0784e3b01f0c606f8945664ab6fa1f Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Thu, 15 May 2014 14:45:33 +0000 Subject: [PATCH 2/2] Fix test for munge_subject_threshold --- t/plugin_tests/spamassassin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/plugin_tests/spamassassin b/t/plugin_tests/spamassassin index dfe6409..ca3ba3b 100644 --- a/t/plugin_tests/spamassassin +++ b/t/plugin_tests/spamassassin @@ -127,7 +127,7 @@ sub test_munge_subject { $transaction->header->add('Subject', $subject); $self->munge_subject($transaction); $r = $transaction->header->get('Subject'); chomp $r; - cmp_ok($r, 'eq', "*** SPAM *** $subject", "+"); + cmp_ok($r, 'eq', "$subject", "+"); }; sub test_get_spam_results {