https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7729--- Comment #4 from Henrik Krohns <
[hidden email]> ---
Slightly revised patch, should not modify @_ as it's used elsewhere..
Eval string will include two extra nosubj codelines if flagged
if ($scoresptr->{q{FOO}}) {
my $nosubj = 1; ### IF FLAGGED
foreach my $l (@_) {
if ($nosubj) { $nosubj = 0; next; } ### IF FLAGGED
if ($l =~ /$qrptr->{q{FOO}}/o) {
$self->got_hit(q{FOO}, "BODY: ", ruletype => "body");
last;
}
}
}
--- lib/Mail/SpamAssassin/Plugin/Check.pm (revision 1864688)
+++ lib/Mail/SpamAssassin/Plugin/Check.pm (working copy)
@@ -821,6 +821,12 @@
dbg("rules-all: running body rule %s", q{'.$rulename.'});
';
}
+ my $nosubject = ($conf->{tflags}->{$rulename}||'') =~ /\bnosubject\b/;
+ if ($nosubject) {
+ $sub .= '
+ my $nosubj = 1;
+ ';
+ }
if (($conf->{tflags}->{$rulename}||'') =~ /\bmultiple\b/)
{
# support multiple matches
@@ -830,6 +836,13 @@
$sub .= '
$hits = 0;
body_'.$loopid.': foreach my $l (@_) {
+ ';
+ if ($nosubject) {
+ $sub .= '
+ if ($nosubj) { $nosubj = 0; next; }
+ ';
+ }
+ $sub .= '
pos $l = 0;
'.$self->hash_line_for_rule($pms, $rulename).'
while ($l =~ /$qrptr->{q{'.$rulename.'}}/go'. ($max? ' && $hits++ <
'.$max:'') .') {
@@ -846,6 +859,13 @@
# instead of if() etc., shaves off 8 perl OPs.
$sub .= '
foreach my $l (@_) {
+ ';
+ if ($nosubject) {
+ $sub .= '
+ if ($nosubj) { $nosubj = 0; next; }
+ ';
+ }
+ $sub .= '
'.$self->hash_line_for_rule($pms, $rulename).'
if ($l =~ /$qrptr->{q{'.$rulename.'}}/o) {
$self->got_hit(q{'.$rulename.'}, "BODY: ", ruletype => "body");
--
You are receiving this mail because:
You are the assignee for the bug.