diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-14 19:15:09 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-14 19:15:09 +0100 |
commit | c9a2191527bb0b020b04c0e19e6d16b576161f0b (patch) | |
tree | b3ed937491c26b6e5d172335ed01da3b4c3a2af4 /lualib/lua_util.lua | |
parent | b90eb3165ecc7e4874250101fdf306d202db38e6 (diff) | |
download | rspamd-c9a2191527bb0b020b04c0e19e6d16b576161f0b.tar.gz rspamd-c9a2191527bb0b020b04c0e19e6d16b576161f0b.zip |
[Minor] Return score with verdict
Diffstat (limited to 'lualib/lua_util.lua')
-rw-r--r-- | lualib/lua_util.lua | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index 27df2c72e..3e443bce3 100644 --- a/lualib/lua_util.lua +++ b/lualib/lua_util.lua @@ -895,7 +895,7 @@ exports.add_debug_alias = function(mod, alias) end ---[[[ -- @function lua_util.get_task_verdict(task) --- Returns verdict for a task, must be called from idempotent filters only +-- Returns verdict for a task + score if certain, must be called from idempotent filters only -- Returns string: -- * `spam`: if message have over reject threshold and has more than one positive rule -- * `junk`: if a message has between score between [add_header/rewrite subject] to reject thresholds and has more than two positive rules @@ -909,28 +909,30 @@ exports.get_task_verdict = function(task) if result then if result.passthrough then - return 'passthrough' + return 'passthrough',nil end + local score = result.score + local action = result.action if action == 'reject' and result.npositive > 1 then - return 'spam' + return 'spam',score elseif action == 'no action' then - if result.score < 0 or result.nnegative > 3 then - return 'ham' + if score < 0 or result.nnegative > 3 then + return 'ham',score end else -- All colors of junk if action == 'add header' or action == 'rewrite subject' then if result.npositive > 2 then - return 'junk' + return 'junk',score end end end - end - return 'uncertain' + return 'uncertain',score + end end ---[[[ |