Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
9178:f226b7b5486b | 9179:82fad995a149 |
---|---|
45 local archive = module:open_store("pubsub_"..node_name, "archive"); | 45 local archive = module:open_store("pubsub_"..node_name, "archive"); |
46 return lib_pubsub.archive_itemstore(archive, node_config, nil, node_name); | 46 return lib_pubsub.archive_itemstore(archive, node_config, nil, node_name); |
47 end | 47 end |
48 | 48 |
49 function simple_broadcast(kind, node, jids, item, actor, node_obj) | 49 function simple_broadcast(kind, node, jids, item, actor, node_obj) |
50 if kind == "retract" then | |
51 kind = "items"; -- XEP-0060 signals retraction in an <items> container | |
52 end | |
53 | |
50 if item then | 54 if item then |
51 item = st.clone(item); | 55 item = st.clone(item); |
52 item.attr.xmlns = nil; -- Clear the pubsub namespace | 56 item.attr.xmlns = nil; -- Clear the pubsub namespace |
53 if expose_publisher and actor then | 57 if expose_publisher and actor then |
54 item.attr.publisher = actor | 58 item.attr.publisher = actor |