Software /
code /
prosody
Comparison
plugins/mod_pep.lua @ 9721:233305015373
mod_pep: Move broadcaster code around to be more like in mod_pubsub
This eases comparing and contrasting these two modules.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 23 Dec 2018 02:53:12 +0100 |
parent | 9607:2a42b72468ca |
child | 9722:695fae2e16b2 |
comparison
equal
deleted
inserted
replaced
9720:e7ddf70ae417 | 9721:233305015373 |
---|---|
134 end | 134 end |
135 end | 135 end |
136 if kind == "retract" then | 136 if kind == "retract" then |
137 kind = "items"; -- XEP-0060 signals retraction in an <items> container | 137 kind = "items"; -- XEP-0060 signals retraction in an <items> container |
138 end | 138 end |
139 local message = st.message({ from = user_bare, type = "headline" }) | |
140 :tag("event", { xmlns = xmlns_pubsub_event }) | |
141 :tag(kind, { node = node }); | |
142 if item then | 139 if item then |
143 item = st.clone(item); | 140 item = st.clone(item); |
144 item.attr.xmlns = nil; -- Clear the pubsub namespace | 141 item.attr.xmlns = nil; -- Clear the pubsub namespace |
145 if kind == "items" then | 142 if kind == "items" then |
146 if node_obj and node_obj.config.include_payload == false then | 143 if node_obj and node_obj.config.include_payload == false then |
147 item:maptags(function () return nil; end); | 144 item:maptags(function () return nil; end); |
148 end | 145 end |
149 end | 146 end |
147 end | |
148 | |
149 local message = st.message({ from = user_bare, type = "headline" }) | |
150 :tag("event", { xmlns = xmlns_pubsub_event }) | |
151 :tag(kind, { node = node }); | |
152 if item then | |
150 message:add_child(item); | 153 message:add_child(item); |
151 end | 154 end |
152 for jid in pairs(jids) do | 155 for jid in pairs(jids) do |
153 module:log("debug", "Sending notification to %s from %s: %s", jid, user_bare, tostring(item)); | 156 module:log("debug", "Sending notification to %s from %s: %s", jid, user_bare, tostring(item)); |
154 message.attr.to = jid; | 157 message.attr.to = jid; |