]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow to add all parameters into `rcpts` and `from` selectors
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 21 Aug 2020 20:36:28 +0000 (21:36 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 21 Aug 2020 20:48:46 +0000 (21:48 +0100)
lualib/lua_selectors/extractors.lua

index 4727b389c6e0a455c029eeb28dc116a178b02073..515d522cb3b2705531a2774b461ed4cc3a68df82 100644 (file)
@@ -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