From: Vsevolod Stakhov Date: Sun, 16 Sep 2018 10:45:04 +0000 (+0100) Subject: [Minor] Fix selectors invocation X-Git-Tag: 1.8.0~96 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=52c90107be7b9dc9bd7d399c88d0bc3dc2a36a77;p=rspamd.git [Minor] Fix selectors invocation --- 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'] = {