2017-08-18 22:17:01 +02:00
|
|
|
local custom_keywords = {
|
|
|
|
['customrl'] = {},
|
|
|
|
}
|
2017-08-30 21:42:39 +02:00
|
|
|
|
2017-08-18 22:17:01 +02:00
|
|
|
function custom_keywords.customrl.get_value(task)
|
|
|
|
local rspamd_logger = require "rspamd_logger"
|
2017-08-30 21:42:39 +02: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-18 22:17:01 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
function custom_keywords.customrl.get_limit(task)
|
|
|
|
local rspamd_logger = require "rspamd_logger"
|
2017-08-30 21:42:39 +02: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-18 22:17:01 +02:00
|
|
|
end
|
|
|
|
end
|
2017-08-30 21:42:39 +02:00
|
|
|
-- returning custom keywords
|
|
|
|
return custom_keywords
|