瀏覽代碼

[Feature] Add extraction type for `from` maps

Attribute name: `extract_from`. Possible values:

* `default` - try smtp, if not exists try mime
* `mime` - check mime only
* `smtp` - check smtp only
* `both` - try to match both
tags/3.8.2
Vsevolod Stakhov 4 月之前
父節點
當前提交
6b1f319e21
No account linked to committer's email address
共有 1 個文件被更改,包括 29 次插入5 次删除
  1. 29
    5
      src/plugins/lua/multimap.lua

+ 29
- 5
src/plugins/lua/multimap.lua 查看文件

@@ -887,12 +887,36 @@ local function multimap_callback(task, rule)
end
end,
from = function()
if task:has_from('smtp') then
local from = task:get_from('smtp')
match_addr(rule, from)
elseif task:has_from('mime') then
local extract_from = rule.extract_from or 'default'

if extract_from == 'mime' then
local from = task:get_from('mime')
match_addr(rule, from)
if from then
match_addr(rule, from)
end
elseif extract_from == 'smtp' then
local from = task:get_from('smtp')
if from then
match_addr(rule, from)
end
elseif extract_from == 'both' then
local from = task:get_from('smtp')
if from then
match_addr(rule, from)
end
from = task:get_from('mime')
if from then
match_addr(rule, from)
end
else
-- Default algorithm
if task:has_from('smtp') then
local from = task:get_from('smtp')
match_addr(rule, from)
elseif task:has_from('mime') then
local from = task:get_from('mime')
match_addr(rule, from)
end
end
end,
helo = function()

Loading…
取消
儲存