]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Use scores from maps if `symbols_set` is not defined
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 30 Apr 2018 15:48:04 +0000 (16:48 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 30 Apr 2018 15:48:04 +0000 (16:48 +0100)
src/plugins/lua/multimap.lua

index e2c5e2f594c8d4b870d52f6be3372988a71dd85d..db80a2b655983da9609730362436cea0a1872fe3 100644 (file)
@@ -505,22 +505,25 @@ local function multimap_callback(task, rule)
           return
         end
         local _,symbol,score = parse_ret(r, result)
-        if symbol and r['symbols_set'] then
-          if not r['symbols_set'][symbol] then
-            rspamd_logger.infox(task, 'symbol %s is not registered for map %s, ' ..
-              'replace it with just %s',
-              symbol, r['symbol'], r['symbol'])
-            symbol = r['symbol']
+        local forced = false
+        if symbol then
+          if r['symbols_set'] then
+            if not r['symbols_set'][symbol] then
+              rspamd_logger.infox(task, 'symbol %s is not registered for map %s, ' ..
+                  'replace it with just %s',
+                  symbol, r['symbol'], r['symbol'])
+              symbol = r['symbol']
+            end
+          else
+            forced = true
           end
-        else
-          symbol = r['symbol']
         end
 
         local opt = value_types[r['type']].get_value(value)
         if opt then
-          task:insert_result(symbol, score, opt)
+          task:insert_result(forced, symbol, score, opt)
         else
-          task:insert_result(symbol, score)
+          task:insert_result(forced, symbol, score)
         end
 
         if pre_filter then