diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-09-16 11:45:04 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-09-16 11:45:04 +0100 |
commit | 52c90107be7b9dc9bd7d399c88d0bc3dc2a36a77 (patch) | |
tree | 7a4ff10c1da3068623ed29b8752754b49c119211 /lualib | |
parent | ca18e04ce01e4c2782f1cf49a8572c03dec155cc (diff) | |
download | rspamd-52c90107be7b9dc9bd7d399c88d0bc3dc2a36a77.tar.gz rspamd-52c90107be7b9dc9bd7d399c88d0bc3dc2a36a77.zip |
[Minor] Fix selectors invocation
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_selectors.lua | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua index 3262da60e..40447a470 100644 --- a/lualib/lua_selectors.lua +++ b/lualib/lua_selectors.lua @@ -53,29 +53,28 @@ local extractors = { end, ['description'] = 'Get source IP address', }, - -- Get SMTP from - ['smtp_from'] = { + -- Get MIME from + ['from'] = { ['type'] = 'email', - ['get_value'] = function(task) - local from = task:get_from(0) + ['get_value'] = function(task, args) + local from = task:get_from(args[1] or 0) if ((from or E)[1] or E).addr then return from[1] end return nil end, - ['description'] = 'Get SMTP from', + ['description'] = 'Get MIME or SMTP from (e.g. from(\'smtp\') or from(\'mime\'), uses any type by default)', }, - -- Get MIME from - ['mime_from'] = { - ['type'] = 'email', - ['get_value'] = function(task) - local from = task:get_from(0) - if ((from or E)[1] or E).addr then - return from[1] + ['rcpts'] = { + ['type'] = 'email_list', + ['get_value'] = function(task, args) + local rcpts = task:get_rcpt(args[1] or 0) + if ((rcpts or E)[1] or E).addr then + return rcpts end return nil end, - ['description'] = 'Get MIME from', + ['description'] = 'Get MIME or SMTP recipients (e.g. rcpts(\'smtp\') or rcpts(\'mime\'), uses any type by default)', }, -- Get country (ASN module must be executed first) ['country'] = { |