At check_end the check already ended, it's not really possible to make
changes (yes the documentation on these is bad, one really needs to look at
the code).

Do a normal eval rule like RW suggested, something like priority 999 or 1001
depending if you want before or after AWL/TxRep..

On Sun, Sep 29, 2019 at 07:52:32PM -0400, Larry Nedry wrote:
> Hello,
> 
> I'm developing a plugin that adds a dynamic rule score to the SA calculated
> score. It works well except when the SA calculated score is less than the
> required_score and the final score is greater that the required_score. In
> this case the X-Spam-Status header always shows "No, score=4.9..." and the
> X-Spam-Report header doesn't get written. If the _SCORE_ is displayed in the
> subject, it shows the correct score.
> 
> Here's the trimmed version of the relevant code:
> 
> sub check_end() {
>     my ( $self, $params ) = @_;
>     my $pms = $params->{permsgstatus};
> 
>     my $sa_score = $pms->get_score();
>     $foo_score = sprintf("%0.3f", $sa_score * 0.10);
> 
>     my $required_score = $pms->get_required_score();
>     if($sa_score > ($required_score - $foo_score)) {
>         $pms->got_hit('FOO', '', score => $foo_score);
>     }
> 
>     return 0;
> }
> 
> Is there a better way to update the SA score?
> 
> Regards,
> Larry

Reply via email to