# HG changeset patch # User Kim Alvefur # Date 1627213947 -7200 # Node ID ddd6e21e58bff26a1536dcbd2e9f3e9b30699073 # Parent d783716103c160ec1277d5b4dd448c5f0a597dad mod_pubsub: Respect 'expose publisher' setting in item retrieval diff -r d783716103c1 -r ddd6e21e58bf plugins/mod_pubsub/mod_pubsub.lua --- a/plugins/mod_pubsub/mod_pubsub.lua Wed May 01 22:33:22 2019 +0200 +++ b/plugins/mod_pubsub/mod_pubsub.lua Sun Jul 25 13:52:27 2021 +0200 @@ -199,6 +199,7 @@ set_service(pubsub.new({ autocreate_on_publish = autocreate_on_publish; autocreate_on_subscribe = autocreate_on_subscribe; + expose_publisher = expose_publisher; nodestore = node_store; itemstore = create_simple_itemstore; diff -r d783716103c1 -r ddd6e21e58bf plugins/mod_pubsub/pubsub.lib.lua --- a/plugins/mod_pubsub/pubsub.lib.lua Wed May 01 22:33:22 2019 +0200 +++ b/plugins/mod_pubsub/pubsub.lib.lua Sun Jul 25 13:52:27 2021 +0200 @@ -328,9 +328,16 @@ return true; end + local expose_publisher = service.config.expose_publisher; + local data = st.stanza("items", { node = node }); for _, id in ipairs(results) do - data:add_child(results[id]); + local item = results[id]; + if not expose_publisher then + item = st.clone(item); + item.attr.publisher = nil; + end + data:add_child(item); end local reply = st.reply(stanza) :tag("pubsub", { xmlns = xmlns_pubsub })