aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_selectors.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-11 19:47:45 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-11 19:47:45 +0000
commitae0ea5dee527e161142eb889312fe7bf4558c88a (patch)
treeffa957fad3f53f32a17a69d2a293d2ab16014f62 /lualib/lua_selectors.lua
parent45d897b7baf8671da3618750ae91e3b17cc91be9 (diff)
downloadrspamd-ae0ea5dee527e161142eb889312fe7bf4558c88a.tar.gz
rspamd-ae0ea5dee527e161142eb889312fe7bf4558c88a.zip
[Minor] Selectors: Add inverse processor
Diffstat (limited to 'lualib/lua_selectors.lua')
-rw-r--r--lualib/lua_selectors.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua
index 4025ef680..ab2692eac 100644
--- a/lualib/lua_selectors.lua
+++ b/lualib/lua_selectors.lua
@@ -524,6 +524,22 @@ Returns either nil or its input if input is in args list]],
Returns either nil or its input if input is not in args list]],
['args_schema'] = ts.array_of(ts.string)
},
+ ['inverse'] = {
+ ['types'] = {
+ ['string'] = true,
+ },
+ ['map_type'] = 'string',
+ ['process'] = function(inp, _, args)
+ if inp then
+ return nil
+ else
+ return (args[1] or 'true'),'string'
+ end
+ end,
+ ['description'] = [[Inverses input.
+Empty string comes the first argument or 'true', non-empty string comes nil]],
+ ['args_schema'] = {ts.string:is_optional()}
+ },
}
local function process_selector(task, sel)