commit 5b78c36: [Feature] Settings: Allow multiple selectors

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Dec 27 18:28:07 UTC 2018


Author: Vsevolod Stakhov
Date: 2018-12-12 14:54:11 +0000
URL: https://github.com/rspamd/rspamd/commit/5b78c367b9cf45c1f32c30ec2e6783fc4c380e63

[Feature] Settings: Allow multiple selectors

---
 src/plugins/lua/settings.lua | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua
index 03f042fc1..62fd63ec7 100644
--- a/src/plugins/lua/settings.lua
+++ b/src/plugins/lua/settings.lua
@@ -356,7 +356,7 @@ local function check_settings(task)
     end
 
     if rule.selector then
-      res = rule.selector(task)
+      res = fun.all(function(s) return s(task) end, rule.selector)
 
       if res then
         matched[#matched + 1] = 'selector'
@@ -656,7 +656,11 @@ local function process_settings_table(tbl)
       end
 
       if sel then
-        out['selector'] = sel
+        if out.selector then
+          table.insert(out['selector'], sel)
+        else
+          out['selector'] = {sel}
+        end
       end
     end
 


More information about the Commits mailing list