changeset 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 2040330586e4
children 9af2d36567a8
files mod_firewall/conditions.lib.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_firewall/conditions.lib.lua	Wed Nov 30 15:37:51 2016 +0100
+++ b/mod_firewall/conditions.lib.lua	Wed Nov 30 15:44:35 2016 +0100
@@ -105,6 +105,11 @@
 	return ("not not (roster_entry and roster_entry.groups[%q])"):format(group), { "roster_entry" };
 end
 
+function condition_handlers.SUBSCRIBED()
+	return "rostermanager.is_contact_subscribed(to_node, to_host, bare_from)",
+	       { "rostermanager", "split_to", "bare_from" };
+end
+
 function condition_handlers.PAYLOAD(payload_ns)
 	return ("stanza:get_child(nil, %q)"):format(payload_ns);
 end