aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/force_actions.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-12-10 11:00:44 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-12-10 11:00:44 +0000
commitbbf0a45bb76a6a55bde375016beaa544ee3309f9 (patch)
tree8bd1480a16ec20b03f13f85115962f8e90a835c1 /src/plugins/lua/force_actions.lua
parenta345b74e1b32981f0a5bc1db7518c9ecc6c7b386 (diff)
downloadrspamd-bbf0a45bb76a6a55bde375016beaa544ee3309f9.tar.gz
rspamd-bbf0a45bb76a6a55bde375016beaa544ee3309f9.zip
[Minor] Force_actions: Allow least actions
Diffstat (limited to 'src/plugins/lua/force_actions.lua')
-rw-r--r--src/plugins/lua/force_actions.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/lua/force_actions.lua b/src/plugins/lua/force_actions.lua
index 4fa4fd7fb..fb863a23b 100644
--- a/src/plugins/lua/force_actions.lua
+++ b/src/plugins/lua/force_actions.lua
@@ -30,7 +30,7 @@ local rspamd_cryptobox_hash = require "rspamd_cryptobox_hash"
local rspamd_expression = require "rspamd_expression"
local rspamd_logger = require "rspamd_logger"
-local function gen_cb(expr, act, pool, message, subject, raction, honor, limit)
+local function gen_cb(expr, act, pool, message, subject, raction, honor, limit, least)
local function parse_atom(str)
local atom = table.concat(fun.totable(fun.take_while(function(c)
@@ -78,10 +78,14 @@ local function gen_cb(expr, act, pool, message, subject, raction, honor, limit)
if subject then
task:set_metric_subject(subject)
end
+
+ local flags = ""
+ if least then flags = "least" end
+
if type(message) == 'string' then
- task:set_pre_result(act, message, N)
+ task:set_pre_result(act, message, N, nil, nil, flags)
else
- task:set_pre_result(act, nil, N)
+ task:set_pre_result(act, nil, N, nil, nil, flags)
end
return true, act
end
@@ -138,10 +142,11 @@ local function configure_module()
local subject = sett.subject
local message = sett.message
local lim = sett.limit or 0
+ local least = sett.least or false
local raction = lua_util.list_to_hash(sett.require_action)
local honor = lua_util.list_to_hash(sett.honor_action)
local cb, atoms = gen_cb(expr, action, rspamd_config:get_mempool(),
- message, subject, raction, honor, lim)
+ message, subject, raction, honor, lim, least)
if cb and atoms then
local t = {}
if (raction or honor) then