comparison mod_firewall/conditions.lib.lua @ 2563:2f1e25706f81

mod_firewall: TO SELF: Use raw stanza.attr.to directly, as 'to' defaults to bare JID if nil
author Matthew Wild <mwild1@gmail.com>
date Fri, 24 Feb 2017 09:50:49 +0000
parents a9eb4d5566f3
children 240985f7d1f7
comparison
equal deleted inserted replaced
2562:78efd064aef3 2563:2f1e25706f81
74 local metadeps = {}; 74 local metadeps = {};
75 return ("to == %s"):format(metaq(to, metadeps)), { "to", unpack(metadeps) }; 75 return ("to == %s"):format(metaq(to, metadeps)), { "to", unpack(metadeps) };
76 end 76 end
77 77
78 function condition_handlers.TO_SELF() 78 function condition_handlers.TO_SELF()
79 return ("to == nil"); 79 -- Intentionally not using 'to' here, as that defaults to bare JID when nil
80 return ("stanza.attr.to == nil");
80 end 81 end
81 82
82 function condition_handlers.TYPE(type) 83 function condition_handlers.TYPE(type)
83 return compile_comparison_list("(type or (name == 'message' and 'normal') or (name == 'presence' and 'available'))", type), { "type", "name" }; 84 return compile_comparison_list("(type or (name == 'message' and 'normal') or (name == 'presence' and 'available'))", type), { "type", "name" };
84 end 85 end