2017-08-19 04:17:01 +08:00
|
|
|
local custom_keywords = {
|
|
|
|
['customrl'] = {},
|
|
|
|
}
|
2017-08-31 03:42:39 +08:00
|
|
|
|
2017-08-19 04:17:01 +08:00
|
|
|
function custom_keywords.customrl.get_value(task)
|
|
|
|
local rspamd_logger = require "rspamd_logger"
|
2017-08-31 03:42:39 +08:00
|
|
|
if task:has_symbol('DYN_RL') then
|
|
|
|
rspamd_logger.infox(rspamd_config, "task has a dynamic ratelimit symbol, processing...")
|
|
|
|
return "check"
|
|
|
|
else
|
|
|
|
rspamd_logger.infox(rspamd_config, "task has no dynamic ratelimit symbol, skipping...")
|
|
|
|
return
|
2017-08-19 04:17:01 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
function custom_keywords.customrl.get_limit(task)
|
|
|
|
local rspamd_logger = require "rspamd_logger"
|
2017-08-31 03:42:39 +08:00
|
|
|
local dyn_rl_symbol = task:get_symbol("DYN_RL")
|
|
|
|
if dyn_rl_symbol then
|
|
|
|
local rl_value = dyn_rl_symbol[1].options[1]
|
|
|
|
rspamd_logger.infox(rspamd_config, "dynamic ratelimit symbol has option %s, returning...", rl_value)
|
|
|
|
return rl_value
|
2017-08-19 04:17:01 +08:00
|
|
|
end
|
|
|
|
end
|
2017-08-31 03:42:39 +08:00
|
|
|
-- returning custom keywords
|
|
|
|
return custom_keywords
|