Mercurial > prosody-hg
comparison plugins/mod_pubsub/pubsub.lib.lua @ 11715:ddd6e21e58bf
mod_pubsub: Respect 'expose publisher' setting in item retrieval
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 25 Jul 2021 13:52:27 +0200 |
| parents | d783716103c1 |
| children | 3ead0967e04d |
comparison
equal
deleted
inserted
replaced
| 11714:d783716103c1 | 11715:ddd6e21e58bf |
|---|---|
| 326 if not ok then | 326 if not ok then |
| 327 origin.send(pubsub_error_reply(stanza, results)); | 327 origin.send(pubsub_error_reply(stanza, results)); |
| 328 return true; | 328 return true; |
| 329 end | 329 end |
| 330 | 330 |
| 331 local expose_publisher = service.config.expose_publisher; | |
| 332 | |
| 331 local data = st.stanza("items", { node = node }); | 333 local data = st.stanza("items", { node = node }); |
| 332 for _, id in ipairs(results) do | 334 for _, id in ipairs(results) do |
| 333 data:add_child(results[id]); | 335 local item = results[id]; |
| 336 if not expose_publisher then | |
| 337 item = st.clone(item); | |
| 338 item.attr.publisher = nil; | |
| 339 end | |
| 340 data:add_child(item); | |
| 334 end | 341 end |
| 335 local reply = st.reply(stanza) | 342 local reply = st.reply(stanza) |
| 336 :tag("pubsub", { xmlns = xmlns_pubsub }) | 343 :tag("pubsub", { xmlns = xmlns_pubsub }) |
| 337 :add_child(data); | 344 :add_child(data); |
| 338 origin.send(reply); | 345 origin.send(reply); |
