Comparison

plugins/mod_pep.lua @ 9722:695fae2e16b2

mod_pep: Add some spacing between blocks in broadcaster to improve readability
author Kim Alvefur <zash@zash.se>
date Sun, 23 Dec 2018 02:54:39 +0100
parent 9721:233305015373
child 9723:3c6e266391a2
comparison
equal deleted inserted replaced
9721:233305015373 9722:695fae2e16b2
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
139 if item then 140 if item then
140 item = st.clone(item); 141 item = st.clone(item);
141 item.attr.xmlns = nil; -- Clear the pubsub namespace 142 item.attr.xmlns = nil; -- Clear the pubsub namespace
142 if kind == "items" then 143 if kind == "items" then
143 if node_obj and node_obj.config.include_payload == false then 144 if node_obj and node_obj.config.include_payload == false then
147 end 148 end
148 149
149 local message = st.message({ from = user_bare, type = "headline" }) 150 local message = st.message({ from = user_bare, type = "headline" })
150 :tag("event", { xmlns = xmlns_pubsub_event }) 151 :tag("event", { xmlns = xmlns_pubsub_event })
151 :tag(kind, { node = node }); 152 :tag(kind, { node = node });
153
152 if item then 154 if item then
153 message:add_child(item); 155 message:add_child(item);
154 end 156 end
157
155 for jid in pairs(jids) do 158 for jid in pairs(jids) do
156 module:log("debug", "Sending notification to %s from %s: %s", jid, user_bare, tostring(item)); 159 module:log("debug", "Sending notification to %s from %s: %s", jid, user_bare, tostring(item));
157 message.attr.to = jid; 160 message.attr.to = jid;
158 module:send(message); 161 module:send(message);
159 end 162 end