Diff

plugins/mod_pubsub/mod_pubsub.lua @ 9179:82fad995a149

util.pubsub: Pass "retract" as the type of such broadcasts This moves some XEP-0060 awkwardness out of util.pubsub and into mod_pubsub A retraction is broadcast in an <items> container, whereas most other kinds of broadcasts are in a container with a name matching the 'kind' attribute.
author Kim Alvefur <zash@zash.se>
date Thu, 16 Aug 2018 14:32:21 +0200
parent 9158:37e814a680ab
child 9181:79cf1f74738f
line wrap: on
line diff
--- a/plugins/mod_pubsub/mod_pubsub.lua	Thu Aug 16 06:05:11 2018 +0200
+++ b/plugins/mod_pubsub/mod_pubsub.lua	Thu Aug 16 14:32:21 2018 +0200
@@ -47,6 +47,10 @@
 end
 
 function simple_broadcast(kind, node, jids, item, actor, node_obj)
+	if kind == "retract" then
+		kind = "items"; -- XEP-0060 signals retraction in an <items> container
+	end
+
 	if item then
 		item = st.clone(item);
 		item.attr.xmlns = nil; -- Clear the pubsub namespace