Software /
code /
prosody
Comparison
plugins/mod_pep.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 | 9160:e13a1a0b0107 |
child | 9189:8fadd3d6c8d3 |
comparison
equal
deleted
inserted
replaced
9178:f226b7b5486b | 9179:82fad995a149 |
---|---|
122 end | 122 end |
123 | 123 |
124 local function get_broadcaster(username) | 124 local function get_broadcaster(username) |
125 local user_bare = jid_join(username, host); | 125 local user_bare = jid_join(username, host); |
126 local function simple_broadcast(kind, node, jids, item) | 126 local function simple_broadcast(kind, node, jids, item) |
127 if kind == "retract" then | |
128 kind = "items"; -- XEP-0060 signals retraction in an <items> container | |
129 end | |
127 local message = st.message({ from = user_bare, type = "headline" }) | 130 local message = st.message({ from = user_bare, type = "headline" }) |
128 :tag("event", { xmlns = xmlns_pubsub_event }) | 131 :tag("event", { xmlns = xmlns_pubsub_event }) |
129 :tag(kind, { node = node }); | 132 :tag(kind, { node = node }); |
130 if item then | 133 if item then |
131 item = st.clone(item); | 134 item = st.clone(item); |