From: Vsevolod Stakhov Date: Tue, 12 Jun 2018 12:52:40 +0000 (+0100) Subject: [Feature] Allow to add symbols using settings directly X-Git-Tag: 1.7.6~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2ca160e852d55eb549f6f78ca7e09cab2b13a0e6;p=thirdparty%2Frspamd.git [Feature] Allow to add symbols using settings directly --- diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index 8e4009162b..468ab6583a 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -55,6 +55,24 @@ local function apply_settings(task, to_apply) task:set_flag(fl) end end + + if to_apply.symbols then + -- Add symbols, specified in the settings + if #to_apply.symbols > 0 then + fun.each(function(val) + task:insert_result(val, 1.0) + end, + fun.filter(function(elt) return type(elt) == 'string' end, + to_apply.symbols)) + else + -- Object like symbols + fun.each(function(k, val) + task:insert_result(k, val.score or 1.0, val.options or {}) + end, + fun.filter(function(_, elt) return type(elt) == 'table' end, + to_apply.symbols)) + end + end end -- Checks for overridden settings within query params and returns 'true' if