Merge pull request #44 from priyadi/master
munge_subject_threshold did not previously work
This commit is contained in:
commit
c74564b4c8
@ -444,12 +444,14 @@ sub munge_subject {
|
|||||||
|
|
||||||
my $sa = $self->get_spam_results($transaction) or return;
|
my $sa = $self->get_spam_results($transaction) or return;
|
||||||
my $qp_num = $self->{_args}{munge_subject_threshold};
|
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");
|
$self->log(LOGDEBUG, "skipping munge, no user or qpsmtpd pref set");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
return unless $sa->{score} > $required;
|
return unless $sa->{score} > $required;
|
||||||
|
return unless $sa->{score} > $qp_num;
|
||||||
|
|
||||||
my $subject_prefix = $self->qp->config('subject_prefix') || '*** SPAM ***';
|
my $subject_prefix = $self->qp->config('subject_prefix') || '*** SPAM ***';
|
||||||
my $subject = $transaction->header->get('Subject') || '';
|
my $subject = $transaction->header->get('Subject') || '';
|
||||||
|
@ -127,7 +127,7 @@ sub test_munge_subject {
|
|||||||
$transaction->header->add('Subject', $subject);
|
$transaction->header->add('Subject', $subject);
|
||||||
$self->munge_subject($transaction);
|
$self->munge_subject($transaction);
|
||||||
$r = $transaction->header->get('Subject'); chomp $r;
|
$r = $transaction->header->get('Subject'); chomp $r;
|
||||||
cmp_ok($r, 'eq', "*** SPAM *** $subject", "+");
|
cmp_ok($r, 'eq', "$subject", "+");
|
||||||
};
|
};
|
||||||
|
|
||||||
sub test_get_spam_results {
|
sub test_get_spam_results {
|
||||||
|
Loading…
Reference in New Issue
Block a user