]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Use has symbol when no need to get extra data for a symbol
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 8 Feb 2016 00:18:01 +0000 (00:18 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 8 Feb 2016 00:22:38 +0000 (00:22 +0000)
src/plugins/lua/dmarc.lua
src/plugins/lua/fann_scores.lua
src/plugins/lua/spamassassin.lua
src/plugins/lua/whitelist.lua

index 91946f039f0ba324ceba0fed4d8c57f3be644494..06509e1c8c188c7cee730b17a3271437bfc91101 100644 (file)
@@ -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
index 079635e466d08ccca507d3bd2296b9b90a5410f4..66a5e18796576d7aeffe08b878f16ed9e78c40bf 100644 (file)
@@ -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
index f2d7a4c4ea07880596c0c0c6eed1f78efb2dccb8..d7406612445f5ec22a5fcee2cb1e433fdbc1f7d7 100644 (file)
@@ -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)
index 3b2b5b25deb81d3450ac42fc277f638ea364fcda..0b620c1e54b9212892245c08a3d7d6c50ac42561 100644 (file)
@@ -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)