]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Selectors: Add scan_result extractor
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 23 Apr 2020 15:13:26 +0000 (16:13 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 23 Apr 2020 15:13:26 +0000 (16:13 +0100)
lualib/lua_selectors/extractors.lua

index c40b93b3b6a4d7fca50c774fb6def074b500f61e..6e023c7806a1d02959fed1a0731311aa0d5e7a82 100644 (file)
@@ -428,8 +428,18 @@ The first argument must be header name.]],
       'Returns the symbol table. See task:get_symbol()',
     ['args_schema'] = {ts.string, ts.string:is_optional()}
   },
-
-
+  -- Get full scan result
+  ['scan_result'] = {
+    ['get_value'] = function(task, args)
+      local res = task:get_metric_result(args[1])
+      if res then
+        return res,'table'
+      end
+    end,
+    ['description'] = 'Get full scan result (either default or shadow if shadow result name is specified)' ..
+        'Returns the result table. See task:get_metric_result()',
+    ['args_schema'] = {ts.string:is_optional()}
+  },
 }
 
 return extractors