]> source.dussan.org Git - rspamd.git/commitdiff
Fix trie plugin.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Apr 2015 17:30:42 +0000 (18:30 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Apr 2015 17:30:42 +0000 (18:30 +0100)
src/plugins/lua/trie.lua

index 81c89fde49934e199be7d99ba23ea20528f80649..81f20bfc8e74bd32cd8e37c105f9a83ca30fa5b6 100644 (file)
@@ -58,12 +58,11 @@ local function tries_callback(task)
       local param = params[idx]
       local pattern = patterns[idx]
       
-      rspamd_logger.debugx("<%1> matched pattern %2 at pos %3",
-        task:get_message_id(), pattern, pos)
-      
-      if params['multi'] or not matched[pattern] then
-        task:insert_result(params['symbol'], 1.0)
-        if not params['multi'] then
+      if param['multi'] or not matched[pattern] then
+        rspamd_logger.debugx("<%1> matched pattern %2 at pos %3",
+          task:get_message_id(), pattern, pos)
+        task:insert_result(param['symbol'], 1.0)
+        if not param['multi'] then
           matched[pattern] = true
         end
       end
@@ -80,6 +79,9 @@ end
 
 local function process_single_pattern(pat, symbol, cf)
   if pat then
+    local multi = false
+    if cf['multi'] then multi = true end
+    
     if cf['raw'] then
       table.insert(raw_patterns, pat)
       table.insert(raw_params, {symbol=symbol, multi=multi})
@@ -100,9 +102,6 @@ local function process_trie_file(symbol, cf)
       rspamd_logger.errx('binary trie patterns are not implemented yet: %1', 
         cf['file'])
     else
-      local multi = false
-      if cf['multi'] then multi = true end
-      
       for line in file:lines() do
         local pat = string.match(line, '^([^#].*[^%s])%s*$')
         process_single_pattern(pat, symbol, cf)