Author: ask
Date: Mon Sep 24 13:45:09 2007
New Revision: 795

Modified:
   trunk/Changes
   trunk/plugins/spamassassin

Log:
Add X-Spam-Level header in spamassassin plugin (idea from Werner Fleck)


Modified: trunk/Changes
==============================================================================
--- trunk/Changes       (original)
+++ trunk/Changes       Mon Sep 24 13:45:09 2007
@@ -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)
 

Modified: trunk/plugins/spamassassin
==============================================================================
--- trunk/plugins/spamassassin  (original)
+++ trunk/plugins/spamassassin  Mon Sep 24 13:45:09 2007
@@ -186,11 +186,18 @@
 
   $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");
 

Reply via email to