Mercurial > prosody-modules
diff mod_firewall/conditions.lib.lua @ 963:c7fca2c9e24f
mod_firewall/conditions: Don't use table.insert, so things are happy when compile_jid_match() returns nil
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 05 Apr 2013 19:18:41 +0100 |
parents | 93ffa3ffc66f |
children | 04e85eb3dfef |
line wrap: on
line diff
--- a/mod_firewall/conditions.lib.lua Fri Apr 05 19:17:33 2013 +0100 +++ b/mod_firewall/conditions.lib.lua Fri Apr 05 19:18:41 2013 +0100 @@ -41,11 +41,12 @@ local function compile_jid_match(which, match_jid) local match_node, match_host, match_resource = jid.split(match_jid); - local conditions = { - compile_jid_match_part(which.."_node", match_node); - compile_jid_match_part(which.."_host", match_host); - match_resource and compile_jid_match_part(which.."_resource", match_resource) or nil; - }; + local conditions = {}; + conditions[#conditions+1] = compile_jid_match_part(which.."_node", match_node); + conditions[#conditions+1] = compile_jid_match_part(which.."_host", match_host); + if match_resource then + conditions[#conditions+1] = compile_jid_match_part(which.."_resource", match_resource); + end return table.concat(conditions, " and "); end