You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2004/08/24 18:07:23 UTC

svn commit: rev 36815 - spamassassin/trunk/lib/Mail/SpamAssassin

Author: felicity
Date: Tue Aug 24 09:07:22 2004
New Revision: 36815

Modified:
   spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
Log:
bug 3705: relative scores worked when all 4 scoresets were specified, but not when only 1 number was given.  fix that, and fix debug output to use the correct variable.  also, instead of 2 sections for 'score rule # # # #' and 'score rule #', always assume all 4 scoresets are specified and deal with the 1 score=>4 scores bit appropriately.

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm	(original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm	Tue Aug 24 09:07:22 2004
@@ -211,7 +211,7 @@
 
       if ($relative && !exists $self->{scoreset}->[0]->{$rule}) {
         my $msg = "Relative score without previous setting in SpamAssassin ".
-                    "configuration, skipping: $_";
+                    "configuration, skipping: $line";
 
         if ($self->{lint_rules}) {
           warn $msg."\n";
@@ -222,7 +222,13 @@
         return;
       }
 
-      if (@scores == 4) {
+      # If we're only passed 1 score, copy it to the other scoresets
+      if (@scores) {
+        if (@scores != 4) {
+          @scores = ( $scores[0], $scores[0], $scores[0], $scores[0] );
+        }
+
+        # Set the actual scoreset values appropriately
         for my $index (0..3) {
           my $score = $relative ?
             $self->{scoreset}->[$index]->{$rule} + $scores[$index] :
@@ -231,13 +237,16 @@
           $self->{scoreset}->[$index]->{$rule} = $score + 0.0;
         }
       }
-      elsif (@scores > 0) {
-        my $score = $relative ?
-          $self->{scoreset}->[0]->{$rule} + $scores[0] : $scores[0];
+      else {
+        my $msg = "Score configuration option without actual scores, skipping: $line";
 
-        for my $index (0..3) {
-          $self->{scoreset}->[$index]->{$rule} = $score + 0.0;
+        if ($self->{lint_rules}) {
+          warn $msg."\n";
+        } else {
+          dbg ($msg);
         }
+        $self->{errors}++;
+        return;
       }
     }
   });