http://bugzilla.spamassassin.org/show_bug.cgi?id=4349





------- Additional Comments From [EMAIL PROTECTED]  2005-07-02 02:21 -------
This is a proof-of-concept of how to do a counting rule.  A new rule type has
been added, "count_body", which will count the number of times the regexp
matches in the body of the email; the score will be set to the number of matches
times the value given to the rule by the "score" directive.  The number of times
matches can also be accessed by meta rules, for use in comparisons and formulas;
examples of these rules are in rules/70_testing.cf

got_pattern_hit(), handle_hit() and got_hit() were modified to accept a "count"
parameter, which defaults to 1 in got_hit() if it isn't defined.  The count,
rather than just plain 1, is stored in $self->{tests_already_hit}->{$rule}, so
that it can be used by the meta rules.  It's a bit hackish to overload
"tests_already_hit" like this, but it works perfectly well.

The meta test code could be tweaked so that the result of the meta test was used
as the "count" for the meta rule, so that something like

    meta SQUARE_SCORE (__TEST * __TEST)

Could be used to have the score of a test increase with the square of the number
of times it was counted.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to