local function dynamic_scan(task, rule)
if rule.dynamic_scan then
if rule.action ~= 'reject' then
- local metric_result = task:get_metric_score('default')
- local metric_action = task:get_metric_action('default')
+ local metric_result = task:get_metric_score()
+ local metric_action = task:get_metric_action()
local has_pre_result = task:has_pre_result()
-- ToDo: needed?
-- Sometimes leads to FPs
local function check_metric_results(task, rule)
if rule.action ~= 'reject' then
- local metric_result = task:get_metric_score('default')
- local metric_action = task:get_metric_action('default')
+ local metric_result = task:get_metric_score()
+ local metric_action = task:get_metric_action()
local has_pre_result = task:has_pre_result()
if rule.symbol_type == 'postfilter' and metric_action == 'reject' then
local message_id = lua_util.maybe_obfuscate_string(task:get_message_id() or '',
settings, 'mid')
- local score = task:get_metric_score('default')[1];
+ local score = task:get_metric_score()[1];
local fields = {
bayes = 'unknown',
fuzzy = 'unknown',
gmt = true, -- The only sane way to sync stuff with different timezones
}))
- local action = task:get_metric_action('default')
+ local action = task:get_metric_action()
local custom_action = ''
if not predefined_actions[action] then
r.direction = "Inbound"
r.user = task:get_user() or 'unknown'
r.qid = task:get_queue_id() or 'unknown'
- r.action = task:get_metric_action('default')
+ r.action = task:get_metric_action()
r.rspamd_server = HOSTNAME
if r.user ~= 'unknown' then
r.direction = "Outbound"
end
- local s = task:get_metric_score('default')[1]
+ local s = task:get_metric_score()[1]
r.score = s
local rcpt = task:get_recipients('smtp')
return extracted
end
- local cact = task:get_metric_action('default')
+ local cact = task:get_metric_action()
if not params.message and not params.subject and params.act and cact == params.act then
return false
end
end
local function greylist_set(task)
- local action = task:get_metric_action('default')
+ local action = task:get_metric_action()
local ip = task:get_ip()
-- Don't do anything if pre-result has been already set
r.user = task:get_user() or 'unknown'
r.qid = task:get_queue_id() or 'unknown'
r.subject = task:get_subject() or 'unknown'
- r.action = task:get_metric_action('default')
+ r.action = task:get_metric_action()
r.rspamd_server = HOSTNAME
- local s = task:get_metric_score('default')[1]
+ local s = task:get_metric_score()[1]
r.score = flatten and string.format('%.2f', s) or s
local fuzzy = task:get_mempool():get_variable("fuzzy_hashes", "fstrings")
return true
end,
is_spam = function(task)
- local action = task:get_metric_action('default')
+ local action = task:get_metric_action()
return is_spam(action)
end,
is_spam_authed = function(task)
if not task:get_user() then
return false
end
- local action = task:get_metric_action('default')
+ local action = task:get_metric_action()
return is_spam(action)
end,
is_reject = function(task)
- local action = task:get_metric_action('default')
+ local action = task:get_metric_action()
return (action == 'reject')
end,
is_reject_authed = function(task)
if not task:get_user() then
return false
end
- local action = task:get_metric_action('default')
+ local action = task:get_metric_action()
return (action == 'reject')
end,
is_not_soft_reject = function(task)
- local action = task:get_metric_action('default')
+ local action = task:get_metric_action()
return (action ~= 'soft reject')
end,
}
common.symbols = task:get_symbols_all()
end
if not common['metric_score'] then
- common['metric_score'] = task:get_metric_score('default')
+ common['metric_score'] = task:get_metric_score()
end
if not common['metric_action'] then
- common['metric_action'] = task:get_metric_action('default')
+ common['metric_action'] = task:get_metric_action()
end
if local_mod.remove then
remove[local_mod.header] = local_mod.remove
local local_mod = settings.routines['x-spamd-bar']
if skip_wanted('x-rspamd-bar') then return end
if not common['metric_score'] then
- common['metric_score'] = task:get_metric_score('default')
+ common['metric_score'] = task:get_metric_score()
end
local score = common['metric_score'][1]
local spambar
local local_mod = settings.routines['x-spam-level']
if skip_wanted('x-spam-level') then return end
if not common['metric_score'] then
- common['metric_score'] = task:get_metric_score('default')
+ common['metric_score'] = task:get_metric_score()
end
local score = common['metric_score'][1]
if score < 1 then
local function spam_header (class, name, value, remove_v)
if skip_wanted(class) then return end
if not common['metric_action'] then
- common['metric_action'] = task:get_metric_action('default')
+ common['metric_action'] = task:get_metric_action()
end
if remove_v then
remove[name] = remove_v
routines['x-spam-status'] = function()
if skip_wanted('x-spam-status') then return end
if not common['metric_score'] then
- common['metric_score'] = task:get_metric_score('default')
+ common['metric_score'] = task:get_metric_score()
end
if not common['metric_action'] then
- common['metric_action'] = task:get_metric_action('default')
+ common['metric_action'] = task:get_metric_action()
end
local score = common['metric_score'][1]
local action = common['metric_action']