diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-08 00:18:01 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-08 00:22:38 +0000 |
commit | 1f9916144e1de13431d341efa9d67272ee3773ee (patch) | |
tree | 81f0f7c759f8da29f2be01012a87e4399c554fad /src/plugins/lua | |
parent | 9cb4f26bd048aaa3a292d7a1ac8161288cbf7bf9 (diff) | |
download | rspamd-1f9916144e1de13431d341efa9d67272ee3773ee.tar.gz rspamd-1f9916144e1de13431d341efa9d67272ee3773ee.zip |
Use has symbol when no need to get extra data for a symbol
Diffstat (limited to 'src/plugins/lua')
-rw-r--r-- | src/plugins/lua/dmarc.lua | 2 | ||||
-rw-r--r-- | src/plugins/lua/fann_scores.lua | 2 | ||||
-rw-r--r-- | src/plugins/lua/spamassassin.lua | 4 | ||||
-rw-r--r-- | src/plugins/lua/whitelist.lua | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua index 91946f039..06509e1c8 100644 --- a/src/plugins/lua/dmarc.lua +++ b/src/plugins/lua/dmarc.lua @@ -196,7 +196,7 @@ local function dmarc_callback(task) -- Check dkim and spf symbols local spf_ok = false local dkim_ok = false - if task:get_symbol(symbols['spf_allow_symbol']) then + if task:has_symbol(symbols['spf_allow_symbol']) then efrom = task:get_from(1) if efrom and efrom[1] and efrom[1]['domain'] then if efrom[1]['domain'] == from[1]['domain'] then diff --git a/src/plugins/lua/fann_scores.lua b/src/plugins/lua/fann_scores.lua index 079635e46..66a5e1879 100644 --- a/src/plugins/lua/fann_scores.lua +++ b/src/plugins/lua/fann_scores.lua @@ -33,7 +33,7 @@ local function fann_scores_filter(task) local fann_input = {} for sym,idx in pairs(symbols) do - if task:get_symbol(sym) then + if task:has_symbol(sym) then fann_input[idx + 1] = 1 else fann_input[idx + 1] = 0 diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index f2d7a4c4e..d74066124 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -909,7 +909,7 @@ local function process_atom(atom, task) return res elseif external_deps[atom] then local res = 0 - if task:get_symbol(atom) then + if task:has_symbol(atom) then res = 1 end rspamd_logger.debugx(task, 'external atom: %1, result: %2', atom, res) @@ -1206,7 +1206,7 @@ local function post_process() local meta_cb = function(task) local res = 0 -- XXX: need to memoize result for better performance - local sym = task:get_symbol(k) + local sym = task:has_symbol(k) if not sym then if expression then res = expression:process(task) diff --git a/src/plugins/lua/whitelist.lua b/src/plugins/lua/whitelist.lua index 3b2b5b25d..0b620c1e5 100644 --- a/src/plugins/lua/whitelist.lua +++ b/src/plugins/lua/whitelist.lua @@ -54,7 +54,7 @@ local function whitelist_cb(symbol, rule, task) if found then if rule['valid_spf'] then -- Check for spf symbol - if not task:get_symbol(options['spf_allow_symbol']) then + if not task:has_symbol(options['spf_allow_symbol']) then found = false rspamd_logger.debugx(task, "domain %s has been found in whitelist %s" .. " but it doesn't have valid SPF record", domain, symbol) @@ -85,7 +85,7 @@ local function whitelist_cb(symbol, rule, task) end end if rule['valid_dmarc'] then - if not task:get_symbol(options['dmarc_allow_symbol']) then + if not task:has_symbol(options['dmarc_allow_symbol']) then found = false rspamd_logger.debugx(task, "domain %s has been found in whitelist %s" .. " but it doesn't have valid DMARC", domain, symbol) |