diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-06-16 20:43:26 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-06-16 20:43:26 +0400 |
commit | a639bf512e3df778fa33c49d83c3996c9fe60d77 (patch) | |
tree | 072c4167dae82382b1c8eef93e0270339635e389 /src/plugins/lua/whitelist.lua | |
parent | c4aab3053d2839e6d3b99f8a542b0a4f54f2b856 (diff) | |
download | rspamd-a639bf512e3df778fa33c49d83c3996c9fe60d77.tar.gz rspamd-a639bf512e3df778fa33c49d83c3996c9fe60d77.zip |
* Change metric logic
* Completely remove lex/yacc readers for config
* Make common sense of metric/action and symbols
* Sync changes with all plugins
TODO: add this to documentation
Diffstat (limited to 'src/plugins/lua/whitelist.lua')
-rw-r--r-- | src/plugins/lua/whitelist.lua | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/plugins/lua/whitelist.lua b/src/plugins/lua/whitelist.lua index e95aca6c7..34867bd2f 100644 --- a/src/plugins/lua/whitelist.lua +++ b/src/plugins/lua/whitelist.lua @@ -1,6 +1,5 @@ -- Module that add symbols to those hosts or from domains that are contained in whitelist -local metric = 'default' local symbol_ip = nil local symbol_from = nil @@ -14,7 +13,7 @@ function check_whitelist (task) if ipn then local key = r:get_key(ipn) if key then - task:insert_result(metric, symbol_ip, 1) + task:insert_result( symbol_ip, 1) end end end @@ -26,7 +25,7 @@ function check_whitelist (task) local _,_,domain = string.find(from, '@(.+)>?$') local key = h:get_key(domain) if key then - task:insert_result(metric, symbol_from, 1) + task:insert_result(symbol_from, 1) end end end @@ -58,16 +57,12 @@ if opts then end end - if opts['metric'] then - metric = opts['metric'] - end -- Register symbol's callback - local m = rspamd_config:get_metric(metric) if symbol_ip then - m:register_symbol(symbol_ip, 1.0, 'check_whitelist') + rspamd_config:register_symbol(symbol_ip, 1.0, 'check_whitelist') elseif symbol_from then - m:register_symbol(symbol_from, 1.0, 'check_whitelist') + rspamd_config:register_symbol(symbol_from, 1.0, 'check_whitelist') end end end |