From: Vsevolod Stakhov Date: Mon, 4 Jul 2016 16:32:03 +0000 (+0100) Subject: [Fix] Avoid `table.getn` method as it has been removed in lua 5.3 X-Git-Tag: 1.3.0~174 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f5aac8de010eaf3221dd152e98a5f1a5208ecb2b;p=rspamd.git [Fix] Avoid `table.getn` method as it has been removed in lua 5.3 Issue: #697 Reported by: @jessbo --- diff --git a/rules/forwarding.lua b/rules/forwarding.lua index c5c8912af..68d0c1095 100644 --- a/rules/forwarding.lua +++ b/rules/forwarding.lua @@ -24,7 +24,7 @@ rspamd_config.FWD_GOOGLE = { local envfrom = task:get_from(1) local envrcpts = task:get_recipients(1) -- Forwarding will only be to a single recipient - if table.getn(envrcpts) > 1 then return false end + if #envrcpts > 1 then return false end -- Get recipient and compute VERP address local rcpt = envrcpts[1].addr:lower() local verp = rcpt:gsub('@','=') @@ -53,7 +53,7 @@ rspamd_config.FWD_SRS = { local envfrom = task:get_from(1) local envrcpts = task:get_recipients(1) -- Forwarding is only to a single recipient - if table.getn(envrcpts) > 1 then return false end + if #envrcpts > 1 then return false end -- Get recipient and compute rewritten SRS address local srs = '=' .. envrcpts[1].domain:lower() .. '=' .. envrcpts[1].user:lower() @@ -74,7 +74,7 @@ rspamd_config.FORWARDED = { if not task:has_recipients(1) then return false end local envrcpts = task:get_recipients(1) -- Forwarding will only be for single recipient messages - if table.getn(envrcpts) > 1 then return false end + if #envrcpts > 1 then return false end -- Get any other headers we might need local lu = task:get_header('List-Unsubscribe') local to = task:get_recipients(2) diff --git a/rules/misc.lua b/rules/misc.lua index e51b0435a..6c3b732b1 100644 --- a/rules/misc.lua +++ b/rules/misc.lua @@ -325,7 +325,7 @@ rspamd_config.ENVFROM_VERP = { local envfrom = task:get_from(1) local envrcpts = task:get_recipients(1) -- VERP only works for single recipient messages - if table.getn(envrcpts) > 1 then return false end + if #envrcpts > 1 then return false end -- Get recipient and compute VERP address local rcpt = envrcpts[1].addr:lower() local verp = rcpt:gsub('@','=')