You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by John Myers <jg...@proofpoint.com> on 2006/01/04 01:45:16 UTC
defining new rule types
Justin Mason wrote:
> Agreed that adding new rule types is *doable*, if not exactly intuitive.
>
>I've done it in the URIBL code, by simply adding eval rules on the fly,
>and that seems to work OK. It'd be nice to have a more intuitive method,
>though.
>
>
I just call PerMsgStatus::got_pattern_hit() from the plugin's
parsed_metadata(). I suppose I'm missing the syntax checks and other
minor things done by Conf::Parser::add_test().
>>The one area that could
>>use work is in providing the default score.
>>
>>
>
>how so? do you mean having a score of != 1.0, by default?
>
>
It appears that since my new type of rules never appear in
$conf->{tests}, they never get assigned a default score.
I do happen to need some of my newly defined tests to have a default
score of 0. For example, suppose there are two lines in the .cf file
using a new rule type "foo":
foo BAR baz
foo BAR quux
If a message matches either condition "baz" or "quux" (or both) then it
will fire the test BAR, which should have a default score of 1. In
order to record the specific condition that caused BAR to be triggered,
it will also fire FOO_baz if "foo" was matched and/or fire FOO_quux if
"quux" was matched. These latter tests are not intended to be weighted,
so should be assigned a default score of 0. It may be worthwhile to
define a new prefix, e.g. "I_" for such informational tests.