Mailing List Archive

svn commit: rev 6908 - in incubator/spamassassin/trunk: lib/Mail/SpamAssassin t
Author: felicity
Date: Thu Feb 26 23:39:32 2004
New Revision: 6908

Modified:
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
incubator/spamassassin/trunk/t/bayesdbm.t
Log:
bug 2657: default body-based rule descriptions wouldn't specify between body, rawbody, full, and uri as expected. I merged got_body_pattern_hit and got_uri_pattern_hit into a single got_pattern_hit, which accepts a description prefix. now using BODY, RAW, FULL, and URI as appropriate.

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Thu Feb 26 23:39:32 2004
@@ -1311,7 +1311,7 @@
foreach ( @_ ) {
'.$self->hash_line_for_rule($rulename).'
if ('.$pat.') {
- $self->got_body_pattern_hit (q{'.$rulename.'});
+ $self->got_pattern_hit (q{'.$rulename.'}, "BODY: ");
'. $self->ran_rule_debug_code ($rulename,"body-text regex", 2) . '
# Ok, we hit, stop now.
last;
@@ -1544,7 +1544,7 @@
foreach ( @_ ) {
'.$self->hash_line_for_rule($rulename).'
if ('.$pat.') {
- $self->got_uri_pattern_hit (q{'.$rulename.'});
+ $self->got_pattern_hit (q{'.$rulename.'}, "URI: ");
'. $self->ran_rule_debug_code ($rulename,"uri test", 4) . '
}
}
@@ -1620,7 +1620,7 @@
foreach ( @_ ) {
'.$self->hash_line_for_rule($rulename).'
if ('.$pat.') {
- $self->got_body_pattern_hit (q{'.$rulename.'});
+ $self->got_pattern_hit (q{'.$rulename.'}, "RAW: ");
'. $self->ran_rule_debug_code ($rulename,"body_pattern_hit", 8) . '
}
}
@@ -1683,7 +1683,7 @@
if ($self->{conf}->{scores}->{q{'.$rulename.'}}) {
'.$self->hash_line_for_rule($rulename).'
if ($$fullmsgref =~ '.$pat.') {
- $self->got_body_pattern_hit (q{'.$rulename.'});
+ $self->got_pattern_hit (q{'.$rulename.'}, "FULL: ");
'. $self->ran_rule_debug_code ($rulename,"full-text regex", 16) . '
}
}
@@ -1998,23 +1998,13 @@

###########################################################################

-sub got_body_pattern_hit {
- my ($self, $rulename) = @_;
+sub got_pattern_hit {
+ my ($self, $rulename, $prefix) = @_;

# only allow each test to hit once per mail
return if (defined $self->{tests_already_hit}->{$rulename});

- $self->got_hit ($rulename, 'BODY: ');
-}
-
-sub got_uri_pattern_hit {
- my ($self, $rulename) = @_;
-
- # only allow each test to hit once per mail
- # TODO: Move this into the rule matcher
- return if (defined $self->{tests_already_hit}->{$rulename});
-
- $self->got_hit ($rulename, 'URI: ');
+ $self->got_hit ($rulename, $prefix);
}

###########################################################################

Modified: incubator/spamassassin/trunk/t/bayesdbm.t
==============================================================================
--- incubator/spamassassin/trunk/t/bayesdbm.t (original)
+++ incubator/spamassassin/trunk/t/bayesdbm.t Thu Feb 26 23:39:32 2004
@@ -234,6 +234,7 @@
# Pretty much we can't count on the data returned with such little training
# so just make sure that the score wasn't equal to .5 which is the default
# return value.
+print "\treturned score: $score\n";
ok($score != .5);

}