diff options
author | Anton Yuzhaninov <citrin+git@citrin.ru> | 2020-12-22 13:05:58 +0000 |
---|---|---|
committer | Anton Yuzhaninov <citrin+git@citrin.ru> | 2020-12-22 13:05:58 +0000 |
commit | a9e9703a896161f1ff96af4d26223428e57f13ad (patch) | |
tree | 0338e955cbfdd1a94df4a0139f79d395f4ae0c31 /rules/forwarding.lua | |
parent | 5cd7131d26a4859953e6b886c6f254676b4da54a (diff) | |
download | rspamd-a9e9703a896161f1ff96af4d26223428e57f13ad.tar.gz rspamd-a9e9703a896161f1ff96af4d26223428e57f13ad.zip |
[Minor] Use task:has_header instead of task:get_header
Use task:has_header() to check if header is exists.
Diffstat (limited to 'rules/forwarding.lua')
-rw-r--r-- | rules/forwarding.lua | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/rules/forwarding.lua b/rules/forwarding.lua index cbbb62c53..0d8c3619e 100644 --- a/rules/forwarding.lua +++ b/rules/forwarding.lua @@ -54,9 +54,7 @@ rspamd_config.FWD_YANDEX = { end local hostname = task:get_hostname() if hostname and hostname:lower():find('%.yandex%.[a-z]+$') then - if task:get_header_raw('X-Yandex-Forward') then - return true - end + return task:has_header('X-Yandex-Forward') end return false end, @@ -72,9 +70,7 @@ rspamd_config.FWD_MAILRU = { end local hostname = task:get_hostname() if hostname and hostname:lower():find('%.mail%.ru$') then - if task:get_header_raw('X-MailRu-Forward') then - return true - end + return task:has_header('X-MailRu-Forward') end return false end, @@ -124,7 +120,7 @@ rspamd_config.FORWARDED = { -- Forwarding will only be for single recipient messages if #envrcpts > 1 then return false end -- Get any other headers we might need - local lu = task:get_header('List-Unsubscribe') + local has_list_unsub = task:has_header('List-Unsubscribe') local to = task:get_recipients(2) local matches = 0 -- Retrieve and loop through all Received headers @@ -139,7 +135,7 @@ rspamd_config.FORWARDED = { -- Check that it doesn't match the envrcpt if not rspamd_util.strequal_caseless(addr, envrcpts[1].addr) then -- Check for mailing-lists as they will have the same signature - if matches < 2 and lu and to and rspamd_util.strequal_caseless(to[1].addr, addr) then + if matches < 2 and has_list_unsub and to and rspamd_util.strequal_caseless(to[1].addr, addr) then return false else return true, 1.0, addr |