Mailing List Archive

svn commit: rev 36406 - spamassassin/trunk/lib/Mail/SpamAssassin
Author: felicity
Date: Sat Aug 14 22:34:26 2004
New Revision: 36406

Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
Log:
bug 3684: relative scores didn't work at all. if we see (score), mark that it's a relative score and remove the parens to avoid an eval call.

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm Sat Aug 14 22:34:26 2004
@@ -198,9 +198,15 @@
my ($self, $key, $value, $line) = @_;
my($rule, @scores) = split(/\s+/, $value);

- my $relative = (@scores > 0 && $scores[0] =~ /^\(\d+(\.\d+)?\)$/) ? 1 : 0;
- if ($relative && !exists $self->{scoreset}->[0]->{$rule})
- {
+ # Figure out if we're doing relative scores, remove the parens if we are
+ my $relative = 0;
+ foreach (@scores) {
+ if (s/^\((-?\d+(?:\.\d+)?)\)$/$1/) {
+ $relative = 1;
+ }
+ }
+
+ if ($relative && !exists $self->{scoreset}->[0]->{$rule}) {
my $msg = "Relative score without previous setting in SpamAssassin ".
"configuration, skipping: $_";