On Sun, 29 Sep 2019 19:52:32 -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?

Take a look at AWL/TxRep, these use a rule priority to run late in
the scan. Doing it that way would give the option for your plugin to
run before or after AWL/TxREP's score averaging just by changing its
priority.


Reply via email to