commit bbf0a45: [Minor] Force_actions: Allow least actions
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Dec 10 11:07:06 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-12-10 11:00:44 +0000
URL: https://github.com/rspamd/rspamd/commit/bbf0a45bb76a6a55bde375016beaa544ee3309f9 (HEAD -> master)
[Minor] Force_actions: Allow least actions
---
src/plugins/lua/force_actions.lua | 13 +++++++++----
1 file 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
More information about the Commits
mailing list