You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2006/09/29 20:37:21 UTC
svn commit: r451381 - in
/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin:
BodyRuleBaseExtractor.pm Rule2XSBody.pm
Author: jm
Date: Fri Sep 29 11:37:20 2006
New Revision: 451381
URL: http://svn.apache.org/viewvc?view=rev&rev=451381
Log:
some method renaming and tidying
Modified:
spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm
spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm
Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm?view=diff&rev=451381&r1=451380&r2=451381
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm Fri Sep 29 11:37:20 2006
@@ -21,7 +21,7 @@
=head1 SYNOPSIS
This is a work-in-progress plugin to extract "base" strings from SpamAssassin
-'body' rules, suitable for use in Rule2XsBody rules.
+'body' rules, suitable for use in Rule2XSBody rules.
=cut
@@ -45,6 +45,8 @@
my $BASES_CAN_USE_QUANTIFIERS = 0; # /foo.*bar/ or /foo*bar/ or /foooo?bar/
my $BASES_CAN_USE_CHAR_CLASSES = 0; # /fo[opqr]bar/
+###########################################################################
+
sub new {
my $class = shift;
my $mailsaobject = shift;
@@ -205,8 +207,6 @@
print OUT "r $base:$key\n";
}
close OUT or die "close failed on $dumpfile!";
-
- # TODO: run re2xs automatically here
warn ("zoom: base extraction complete for $ruletype: yes=$yes no=$no\n");
}
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=451381&r1=451380&r2=451381
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm Fri Sep 29 11:37:20 2006
@@ -41,20 +41,18 @@
sub finish_parsing_end {
my ($self, $params) = @_;
my $conf = $params->{conf};
- $self->run_test_set ($conf, $conf->{body_tests}, 'body');
+ $self->setup_test_set ($conf, $conf->{body_tests}, 'body');
}
-sub run_test_set {
+sub setup_test_set {
my ($self, $conf, $test_set, $ruletype) = @_;
foreach my $pri (keys %{$test_set}) {
my $nicepri = $pri; $nicepri =~ s/-/neg/g;
- $self->check_all($conf, $test_set->{$pri}, $ruletype.'_'.$nicepri);
+ $self->setup_test_set_pri($conf, $test_set->{$pri}, $ruletype.'_'.$nicepri);
}
}
-###########################################################################
-
-sub check_all {
+sub setup_test_set_pri {
my ($self, $conf, $rules, $ruletype) = @_;
my $modname = "Mail::SpamAssassin::CompiledRegexps::".$ruletype;
@@ -105,6 +103,8 @@
return 0;
}
+###########################################################################
+
sub run_body_hack {
my ($self, $params) = @_;
@@ -141,6 +141,10 @@
# ignore 0-scored rules, of course
next unless $scoresptr->{$rulename};
+ # TODO: it would be very useful to provide an optional
+ # means of instrumenting the ruleset, so that we can
+ # find out when the base matched but the full RE didn't.
+
# if ($do_dbg) {
# dbg("zoom: base found for $rulename: $line");
# }
@@ -155,5 +159,7 @@
dbg("zoom: run_body_hack for $ruletype done");
}
+
+###########################################################################
1;