diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-06-28 23:19:36 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-06-28 23:19:36 +0100 |
commit | cbc767de53242ae1d88bf047db0123bf939ad64e (patch) | |
tree | 0faae2ca918e60649ecb87a9604ead3b4a3a28d3 /src/plugins/lua/emails.lua | |
parent | 59bcaad8221610804d99ae862dab0cfbdabf2dc1 (diff) | |
download | rspamd-cbc767de53242ae1d88bf047db0123bf939ad64e.tar.gz rspamd-cbc767de53242ae1d88bf047db0123bf939ad64e.zip |
Use more recent lua conventions in emails module.
Diffstat (limited to 'src/plugins/lua/emails.lua')
-rw-r--r-- | src/plugins/lua/emails.lua | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/plugins/lua/emails.lua b/src/plugins/lua/emails.lua index 7df5262d0..36776a089 100644 --- a/src/plugins/lua/emails.lua +++ b/src/plugins/lua/emails.lua @@ -37,8 +37,8 @@ local function check_email_rule(task, rule, addr) local function emails_dns_cb(resolver, to_resolve, results, err) task:inc_dns_req() if results then - logger.info(string.format('<%s> email: [%s] resolved for symbol: %s', - task:get_message_id(), to_resolve, rule['symbol'])) + logger.infox('<%1> email: [%2] resolved for symbol: %3', + task:get_message_id(), to_resolve, rule['symbol']) task:insert_result(rule['symbol'], 1) end end @@ -56,15 +56,15 @@ local function check_email_rule(task, rule, addr) local key = addr:get_host() if rule['map']:get_key(key) then task:insert_result(rule['symbol'], 1) - logger.info(string.format('<%s> email: \'%s\' is found in list: %s', - task:get_message_id(), key, rule['symbol'])) + logger.infox('<%1> email: \'%2\' is found in list: %3', + task:get_message_id(), key, rule['symbol']) end else local key = string.format('%s@%s', addr:get_user(), addr:get_host()) if rule['map']:get_key(key) then task:insert_result(rule['symbol'], 1) - logger.info(string.format('<%s> email: \'%s\' is found in list: %s', - task:get_message_id(), key, rule['symbol'])) + logger.infox('<%1> email: \'%2\' is found in list: %3', + task:get_message_id(), key, rule['symbol']) end end end @@ -87,16 +87,6 @@ local function check_emails(task) end end - --- Registration -if type(rspamd_config.get_api_version) ~= 'nil' then - if rspamd_config:get_api_version() >= 2 then - rspamd_config:register_module_option('emails', 'rule', 'string') - else - logger.err('Invalid rspamd version for this plugin') - end -end - local opts = rspamd_config:get_all_opt('emails', 'rule') if opts and type(opts) == 'table' then for k,v in pairs(opts) do |