comparison mod_firewall/conditions.lib.lua @ 2403:f96bdfd81eba

mod_firewall: SUBSCRIBED - condition that is true if the receiver of a stanza is subscribed to the sender
author Kim Alvefur <zash@zash.se>
date Wed, 30 Nov 2016 15:44:35 +0100
parents 00eed68f63bf
children bd69ffe071e6
comparison
equal deleted inserted replaced
2402:2040330586e4 2403:f96bdfd81eba
101 return "not "..(in_roster_requirement and "not" or "").." roster_entry", { "roster_entry" }; 101 return "not "..(in_roster_requirement and "not" or "").." roster_entry", { "roster_entry" };
102 end 102 end
103 103
104 function condition_handlers.IN_ROSTER_GROUP(group) 104 function condition_handlers.IN_ROSTER_GROUP(group)
105 return ("not not (roster_entry and roster_entry.groups[%q])"):format(group), { "roster_entry" }; 105 return ("not not (roster_entry and roster_entry.groups[%q])"):format(group), { "roster_entry" };
106 end
107
108 function condition_handlers.SUBSCRIBED()
109 return "rostermanager.is_contact_subscribed(to_node, to_host, bare_from)",
110 { "rostermanager", "split_to", "bare_from" };
106 end 111 end
107 112
108 function condition_handlers.PAYLOAD(payload_ns) 113 function condition_handlers.PAYLOAD(payload_ns)
109 return ("stanza:get_child(nil, %q)"):format(payload_ns); 114 return ("stanza:get_child(nil, %q)"):format(payload_ns);
110 end 115 end