]> git.proxmox.com Git - pmg-api.git/commit
RuleCache: reorganize how we gather marks and spaminfo
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 21 Feb 2024 12:24:27 +0000 (13:24 +0100)
committerStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 21 Feb 2024 18:30:13 +0000 (19:30 +0100)
commit90ce7abb46f65277edea089401c0e0fc854d4afd
tree7a4ccd8fc117f4199d663b2322ed5641e4fb59f3
parente3c530d8696314991c167b8b39fd81b6551edd12
RuleCache: reorganize how we gather marks and spaminfo

currently, we gather the marks and the spaminfo separately,
with the following properties:
* both are gathered with what matches
* virus and spam matches are global (i.e. not marks but [] to mark the
  whole mail)
* only the spam match can differ per user (wl/bl)
* all matches are or'ed (so order and global/per part does not make much
  of a difference for matching the rule)
* marks are saved once globally per rule and per target
* spaminfo is saved per target

instead collect spaminfo once and marks per target together. With this,
we can omit the 'global' marks list, since each target has their own
anyway. Also saves the spaminfo only once, since that must be the same
for the mail regardless of target.

Since that shouldn't change the current matching behavior (all marks
are identical for the whole rule), we can simply use the marks from the
first target in `Remove` (the only action where the marks are relevant).

This makes it easier for us when we'll implement and/invert for matches,
as the marks can differ between targets. That is, because the spamlevel
can diverge for them and that can be and-combined with objects that add
marks.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PMG/RuleCache.pm
src/PMG/RuleDB/Remove.pm
src/bin/pmg-smtp-filter