aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-04 17:53:58 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-04 17:53:58 +0000
commite4ac34be79aa9bbbfe2926e37f443c32221cbfe0 (patch)
treea55e60e0e9296065a5d59a2039e6e9fc11c58ff4 /src/plugins
parent503d1bceb2df4b88acd41455ddebf0efae9fd391 (diff)
downloadrspamd-e4ac34be79aa9bbbfe2926e37f443c32221cbfe0.tar.gz
rspamd-e4ac34be79aa9bbbfe2926e37f443c32221cbfe0.zip
[Feature] Add verdict library in lua
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/clustering.lua3
-rw-r--r--src/plugins/lua/neural.lua3
-rw-r--r--src/plugins/lua/ratelimit.lua3
-rw-r--r--src/plugins/lua/reputation.lua5
4 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/lua/clustering.lua b/src/plugins/lua/clustering.lua
index 0b514476c..45e5d4bc1 100644
--- a/src/plugins/lua/clustering.lua
+++ b/src/plugins/lua/clustering.lua
@@ -24,6 +24,7 @@ local N = 'clustering'
local rspamd_logger = require "rspamd_logger"
local lua_util = require "lua_util"
+local lua_verdict = require "lua_verdict"
local lua_redis = require "lua_redis"
local lua_selectors = require "lua_selectors"
local ts = require("tableshape").types
@@ -190,7 +191,7 @@ local function clusterting_idempotent_cb(task, rule)
if task:has_flag('skip') then return end
if not rule.allow_local and lua_util.is_rspamc_or_controller(task) then return end
- local verdict = lua_util.get_task_verdict(task)
+ local verdict = lua_verdict.get_specific_verdict(N, task)
local score
if verdict == 'ham' then
diff --git a/src/plugins/lua/neural.lua b/src/plugins/lua/neural.lua
index cb3a51300..d96ca896a 100644
--- a/src/plugins/lua/neural.lua
+++ b/src/plugins/lua/neural.lua
@@ -28,6 +28,7 @@ local fun = require "fun"
local lua_settings = require "lua_settings"
local meta_functions = require "lua_meta"
local ts = require("tableshape").types
+local lua_verdict = require "lua_verdict"
local N = "neural"
-- Module vars
@@ -1164,7 +1165,7 @@ local function ann_push_vector(task)
return
end
- local verdict,score = lua_util.get_task_verdict(task)
+ local verdict,score = lua_verdict.get_specific_verdict(N, task)
if verdict == 'passthrough' then
lua_util.debugm(N, task, 'ignore task as its verdict is %s(%s)',
diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua
index bd77b1ad6..731bd7ac3 100644
--- a/src/plugins/lua/ratelimit.lua
+++ b/src/plugins/lua/ratelimit.lua
@@ -26,6 +26,7 @@ local lua_redis = require "lua_redis"
local fun = require "fun"
local lua_maps = require "lua_maps"
local lua_util = require "lua_util"
+local lua_verdict = require "lua_verdict"
local rspamd_hash = require "rspamd_cryptobox_hash"
local lua_selectors = require "lua_selectors"
local ts = require("tableshape").types
@@ -666,7 +667,7 @@ local function ratelimit_update_cb(task)
return
end
- local verdict = lua_util.get_task_verdict(task)
+ local verdict = lua_verdict.get_specific_verdict(N, task)
local _,nrcpt = task:has_recipients('smtp')
if not nrcpt or nrcpt <= 0 then
nrcpt = 1
diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua
index 8b2b8c5a4..f88973d71 100644
--- a/src/plugins/lua/reputation.lua
+++ b/src/plugins/lua/reputation.lua
@@ -109,9 +109,10 @@ end
-- Extracts task score and subtracts score of the rule itself
local function extract_task_score(task, rule)
- local _,score = lua_util.get_task_verdict(task)
+ local lua_verdict = require "lua_verdict"
+ local verdict,score = lua_verdict.get_specific_verdict(N, task)
- if not score then return nil end
+ if not score or verdict == 'passthrough' then return nil end
return sub_symbol_score(task, rule, score)
end