aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_selectors
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-21 21:36:28 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-21 21:48:46 +0100
commit450d49c880e636c35df96e65339803ede0fc0b2c (patch)
tree1b91110b86d11a5af605a2a4e4f4d8a3801a3547 /lualib/lua_selectors
parent71e58489aa8efbc883ba961b1f1cf15eebec3c87 (diff)
downloadrspamd-450d49c880e636c35df96e65339803ede0fc0b2c.tar.gz
rspamd-450d49c880e636c35df96e65339803ede0fc0b2c.zip
[Minor] Allow to add all parameters into `rcpts` and `from` selectors
Diffstat (limited to 'lualib/lua_selectors')
-rw-r--r--lualib/lua_selectors/extractors.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/lualib/lua_selectors/extractors.lua b/lualib/lua_selectors/extractors.lua
index 4727b389c..515d522cb 100644
--- a/lualib/lua_selectors/extractors.lua
+++ b/lualib/lua_selectors/extractors.lua
@@ -58,7 +58,12 @@ For example, `list('foo', 'bar')` returns a list {'foo', 'bar'}]],
-- Get MIME from
['from'] = {
['get_value'] = function(task, args)
- local from = task:get_from(args[1] or 0)
+ local from
+ if type(args) == 'table' then
+ from = task:get_from(args)
+ else
+ from = task:get_from(0)
+ end
if ((from or E)[1] or E).addr then
return from[1],'table'
end
@@ -69,7 +74,12 @@ uses any type by default)]],
},
['rcpts'] = {
['get_value'] = function(task, args)
- local rcpts = task:get_recipients(args[1] or 0)
+ local rcpts
+ if type(args) == 'table' then
+ rcpts = task:get_recipients(args)
+ else
+ rcpts = task:get_recipients(0)
+ end
if ((rcpts or E)[1] or E).addr then
return rcpts,'table_list'
end