diff options
author | Kim Alvefur <zash@zash.se> | 2018-08-16 14:32:21 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-08-16 14:32:21 +0200 |
commit | 98c9778cc77d1d81300742e34c81c20a44accef1 (patch) | |
tree | ae0edbc4facdcd6150d87ce35800e68ded54b145 | |
parent | 16f48337f31a4edfade237a5f6efe08e6a2ec887 (diff) | |
download | prosody-98c9778cc77d1d81300742e34c81c20a44accef1.tar.gz prosody-98c9778cc77d1d81300742e34c81c20a44accef1.zip |
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.
-rw-r--r-- | plugins/mod_pep.lua | 3 | ||||
-rw-r--r-- | plugins/mod_pubsub/mod_pubsub.lua | 4 | ||||
-rw-r--r-- | util/pubsub.lua | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/plugins/mod_pep.lua b/plugins/mod_pep.lua index 4239ce66..777783da 100644 --- a/plugins/mod_pep.lua +++ b/plugins/mod_pep.lua @@ -124,6 +124,9 @@ end local function get_broadcaster(username) local user_bare = jid_join(username, host); local function simple_broadcast(kind, node, jids, item) + if kind == "retract" then + kind = "items"; -- XEP-0060 signals retraction in an <items> container + end local message = st.message({ from = user_bare, type = "headline" }) :tag("event", { xmlns = xmlns_pubsub_event }) :tag(kind, { node = node }); diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua index cea4e6b2..d18d5f9f 100644 --- a/plugins/mod_pubsub/mod_pubsub.lua +++ b/plugins/mod_pubsub/mod_pubsub.lua @@ -47,6 +47,10 @@ local function create_simple_itemstore(node_config, node_name) 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 diff --git a/util/pubsub.lua b/util/pubsub.lua index 88622ea0..be3f0e7c 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -523,7 +523,7 @@ function service:retract(node, actor, id, retract) end self.events.fire_event("item-retracted", { node = node, actor = actor, id = id }); if retract then - self.config.broadcaster("items", node, node_obj.subscribers, retract, actor, node_obj, self); + self.config.broadcaster("retract", node, node_obj.subscribers, retract, actor, node_obj, self); end return true end |