spamassassin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j.@apache.org
Subject svn commit: r468405 - /spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm
Date Fri, 27 Oct 2006 15:01:27 GMT
Author: jm
Date: Fri Oct 27 08:01:27 2006
New Revision: 468405

URL: http://svn.apache.org/viewvc?view=rev&rev=468405
Log:
support new not-always-generated one-line body subs

Modified:
    spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm?view=diff&rev=468405&r1=468404&r2=468405
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm Fri Oct
27 08:01:27 2006
@@ -63,7 +63,8 @@
     return 0;
   }
 
-  $conf->{skip_body_rules} = { };
+  $conf->{skip_body_rules}   ||= { };
+  $conf->{need_one_line_sub} ||= { };
 
   my $found = 0;
   foreach my $name (keys %{$rules}) {
@@ -81,6 +82,11 @@
     # TODO: need a cleaner way to do this.  I expect when rule types
     # are implementable in plugins, I can do it that way
     $conf->{skip_body_rules}->{$name} = 1;
+
+    # ensure that the one-liner version of the function call is
+    # created, though
+    $conf->{generate_body_one_line_sub}->{$name} = 1;
+
     $found++;
   }
 
@@ -149,9 +155,17 @@
 	# dbg("zoom: base found for $rulename: $line");
 	# }
 
-        # run the real regexp -- on this line alone
-        &{'Mail::SpamAssassin::PerMsgStatus::'.$rulename.'_one_line_body_test'}
-                    ($scanner, $line);
+	my $fn = 'Mail::SpamAssassin::PerMsgStatus::'.
+				$rulename.'_one_line_body_test';
+
+        # run the real regexp -- on this line alone.
+	# don't try this unless the fn exists; this can happen if the
+	# installed compiled-rules file contains details of rules
+	# that are not in our current ruleset (e.g. gets out of
+	# sync, or was compiled with extra rulesets installed)
+	if (defined &{$fn}) {
+	  &{$fn} ($scanner, $line);
+	}
       }
     }
     use strict "refs";



Mime
View raw message