diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-06-15 11:24:21 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-06-15 11:24:21 +0100 |
commit | 6541d1c6925d3cda8b2f1751445b409fde28c768 (patch) | |
tree | c1afabe29b44a9c18232637a2518dac936b52581 /src/plugins/lua | |
parent | ad78012dd91c21820437f03e1864ea2d497c8b8d (diff) | |
download | rspamd-6541d1c6925d3cda8b2f1751445b409fde28c768.tar.gz rspamd-6541d1c6925d3cda8b2f1751445b409fde28c768.zip |
[Minor] Add more default scores :(
Diffstat (limited to 'src/plugins/lua')
-rw-r--r-- | src/plugins/lua/multimap.lua | 3 | ||||
-rw-r--r-- | src/plugins/lua/spamassassin.lua | 20 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index f82a4fb38..1ef2dbe12 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -1260,7 +1260,8 @@ if opts and type(opts) == 'table' then rspamd_config:register_symbol({ type = 'virtual', name = s, - parent = id + parent = id, + score = 0, -- Default score }) rule['symbols_set'][s] = 1 end, rule['symbols']) diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index 4ebe588b4..f69c5aa66 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -1532,6 +1532,7 @@ local function post_process() if not expression then rspamd_logger.errx(rspamd_config, 'Cannot parse expression ' .. r['meta']) else + if r['score'] then rspamd_config:set_metric_symbol{ name = k, score = r['score'], @@ -1540,14 +1541,21 @@ local function post_process() one_shot = true } scores_added[k] = 1 + rspamd_config:register_symbol{ + name = k, + weight = calculate_score(k, r), + callback = meta_cb + } + else + -- Add 0 score to avoid issues + rspamd_config:register_symbol{ + name = k, + weight = calculate_score(k, r), + callback = meta_cb, + score = 0, + } end - rspamd_config:register_symbol{ - name = k, - weight = calculate_score(k, r), - callback = meta_cb - } - r['expression'] = expression if not atoms[k] then |