aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_squeeze_rules.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-09 12:11:21 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-09 12:11:21 +0100
commit498a8112a11c8b622010dae023e13017e8748be1 (patch)
tree63c5a198526dcc4a36e7b028267064e1a0637a42 /lualib/lua_squeeze_rules.lua
parentc949b41dd7f6dd8e4312cdf640a791c2f02818a9 (diff)
downloadrspamd-498a8112a11c8b622010dae023e13017e8748be1.tar.gz
rspamd-498a8112a11c8b622010dae023e13017e8748be1.zip
[Fix] Fix weights of dynamic squeezed rules
Diffstat (limited to 'lualib/lua_squeeze_rules.lua')
-rw-r--r--lualib/lua_squeeze_rules.lua31
1 files changed, 26 insertions, 5 deletions
diff --git a/lualib/lua_squeeze_rules.lua b/lualib/lua_squeeze_rules.lua
index ef098a2d3..dd68ccb61 100644
--- a/lualib/lua_squeeze_rules.lua
+++ b/lualib/lua_squeeze_rules.lua
@@ -42,20 +42,41 @@ local function gen_lua_squeeze_function(order)
if first then
table.remove(ret, 1)
- if type(ret[1]) == 'table' then
- task:insert_result(sym, 1.0, ret[1])
+ local second = ret[2]
+
+ if type(second) == 'number' then
+ table.remove(ret, 1)
+ if second ~= 0 then
+ if type(ret[1]) == 'table' then
+ task:insert_result(sym, second, ret[1])
+ else
+ task:insert_result(sym, second, ret)
+ end
+ end
else
- task:insert_result(sym, 1.0, ret)
+ if type(ret[1]) == 'table' then
+ task:insert_result(sym, 1.0, ret[1])
+ else
+ task:insert_result(sym, 1.0, ret)
+ end
end
end
elseif type(first) == 'number' then
table.remove(ret, 1)
if first ~= 0 then
- task:insert_result(sym, first, ret)
+ if type(ret[1]) == 'table' then
+ task:insert_result(sym, first, ret[1])
+ else
+ task:insert_result(sym, first, ret)
+ end
end
else
- task:insert_result(sym, 1.0, ret)
+ if type(ret[1]) == 'table' then
+ task:insert_result(sym, 1.0, ret[1])
+ else
+ task:insert_result(sym, 1.0, ret)
+ end
end
end
else