Rule2XSBody.pm (Mail-SpamAssassin-3.4.3.tar.bz2) | : | Rule2XSBody.pm (Mail-SpamAssassin-3.4.4.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 222 | skipping to change at line 222 | |||
dbg("zoom: run_body_fast_scan for $ruletype start"); | dbg("zoom: run_body_fast_scan for $ruletype start"); | |||
my $do_dbg = (would_log('dbg', 'zoom') > 1); | my $do_dbg = (would_log('dbg', 'zoom') > 1); | |||
my $scoresptr = $conf->{scores}; | my $scoresptr = $conf->{scores}; | |||
my $modname = "Mail::SpamAssassin::CompiledRegexps::".$ruletype; | my $modname = "Mail::SpamAssassin::CompiledRegexps::".$ruletype; | |||
{ | { | |||
no strict "refs"; | no strict "refs"; | |||
my $lineidx; | ||||
foreach my $line (@{$params->{lines}}) | foreach my $line (@{$params->{lines}}) | |||
{ | { | |||
$lineidx++; | ||||
# unfortunately, calling lc() here seems to be the fastest | # unfortunately, calling lc() here seems to be the fastest | |||
# way to support this and still work with UTF-8 ok | # way to support this and still work with UTF-8 ok | |||
my $results = &{$modname.'::scan'}(lc $line); | my $results = &{$modname.'::scan'}(lc $line); | |||
my %alreadydone; | my %alreadydone; | |||
foreach my $ruleandflags (@{$results}) | foreach my $ruleandflags (@{$results}) | |||
{ | { | |||
# only try each rule once per line | # only try each rule once per line | |||
next if exists $alreadydone{$ruleandflags}; | next if exists $alreadydone{$ruleandflags}; | |||
$alreadydone{$ruleandflags} = undef; | $alreadydone{$ruleandflags} = undef; | |||
my $rulename = $ruleandflags; | my $rulename = $ruleandflags; | |||
my $flags = ($rulename =~ s/,\[(.*?)\]$//)?$1:''; | my $flags = ($rulename =~ s/,\[(.*?)\]$//)?$1:''; | |||
# ignore 0-scored rules, of course | # ignore 0-scored rules, of course | |||
next unless $scoresptr->{$rulename}; | next unless $scoresptr->{$rulename}; | |||
# skip first line if nosubject tflag | ||||
if ($lineidx == 1 && ($conf->{tflags}->{$rulename}||'') =~ /\bnosubject\ | ||||
b/) { | ||||
next; | ||||
} | ||||
# non-lossy rules; the re2c version matches exactly what | # non-lossy rules; the re2c version matches exactly what | |||
# the perl regexp matches, so we don't need to perform | # the perl regexp matches, so we don't need to perform | |||
# a validation match to follow up; it's a hit! | # a validation match to follow up; it's a hit! | |||
if ($flags =~ /\bl=0/) { | if ($flags =~ /\bl=0/) { | |||
$scanner->got_hit($rulename, "BODY: ", ruletype => "one_line_body"); | $scanner->got_hit($rulename, "BODY: ", ruletype => "one_line_body"); | |||
# TODO: hit_rule_plugin_code? it's just debugging really | # TODO: hit_rule_plugin_code? it's just debugging really | |||
next; | next; | |||
} | } | |||
# dbg("zoom: base found for $rulename: $line"); | # dbg("zoom: base found for $rulename: $line"); | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 9 lines changed or added |