diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-07 18:30:42 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-07 18:30:42 +0100 |
commit | 0d097bd44950e3439d7200a1f2c81a8d8c9e9b39 (patch) | |
tree | 180fceaec1423dda73b34aeb74bded76132a1b58 /src/plugins/lua/trie.lua | |
parent | dd2422ddd09105156f5a4480666130025fc83f33 (diff) | |
download | rspamd-0d097bd44950e3439d7200a1f2c81a8d8c9e9b39.tar.gz rspamd-0d097bd44950e3439d7200a1f2c81a8d8c9e9b39.zip |
Fix trie plugin.
Diffstat (limited to 'src/plugins/lua/trie.lua')
-rw-r--r-- | src/plugins/lua/trie.lua | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/plugins/lua/trie.lua b/src/plugins/lua/trie.lua index 81c89fde4..81f20bfc8 100644 --- a/src/plugins/lua/trie.lua +++ b/src/plugins/lua/trie.lua @@ -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) |