From 475203689d1d4d0d8173d96194f6c4297d746d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Mon, 24 Sep 2007 20:45:09 +0000 Subject: [PATCH] Add X-Spam-Level header in spamassassin plugin (idea from Werner Fleck) git-svn-id: https://svn.perl.org/qpsmtpd/trunk@795 958fd67b-6ff1-0310-b445-bb7760255be9 --- Changes | 2 ++ plugins/spamassassin | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/Changes b/Changes index 89472a2..8de651f 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ 0.41 + Add X-Spam-Level header in spamassassin plugin (idea from Werner Fleck) + Remove the auth/authnull sample plugin (there are plenty proper examples now so we don't have to include this insecure plugin) diff --git a/plugins/spamassassin b/plugins/spamassassin index acc03fb..09e7c1b 100644 --- a/plugins/spamassassin +++ b/plugins/spamassassin @@ -186,11 +186,18 @@ sub hook_data_post { # check_spam $self->_cleanup_spam_header($transaction, 'X-Spam-Flag'); $self->_cleanup_spam_header($transaction, 'X-Spam-Status'); + $self->_cleanup_spam_header($transaction, 'X-Spam-Level'); $transaction->header->add('X-Spam-Flag', 'YES', 0) if ($flag eq 'Yes'); $transaction->header->add('X-Spam-Status', "$flag, hits=$hits required=$required\n" . "\ttests=$tests", 0); + + my $length = int($hits); + $length = 1 if $length < 1; + $length = 50 if $length > 50; + $transaction->header->add('X-Spam-Level', '*' x $length, 0); + $self->log(LOGNOTICE, "check_spam: $flag, hits=$hits, required=$required, " . "tests=$tests");