aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-07-25 13:52:27 +0200
committerKim Alvefur <zash@zash.se>2021-07-25 13:52:27 +0200
commit8e27e5311a7b5589b7254afe10cbf5962547f25c (patch)
tree78450f9ae770bd05b29d93979a55258fcc684484 /plugins
parent23dbdae2aafb4722367446dd700e972d9f499125 (diff)
downloadprosody-8e27e5311a7b5589b7254afe10cbf5962547f25c.tar.gz
prosody-8e27e5311a7b5589b7254afe10cbf5962547f25c.zip
mod_pubsub: Respect 'expose publisher' setting in item retrieval
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_pubsub/mod_pubsub.lua1
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua9
2 files changed, 9 insertions, 1 deletions
diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua
index 19834ad4..6866312c 100644
--- a/plugins/mod_pubsub/mod_pubsub.lua
+++ b/plugins/mod_pubsub/mod_pubsub.lua
@@ -199,6 +199,7 @@ function module.load()
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 --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua
index 6214882f..c750ecb8 100644
--- a/plugins/mod_pubsub/pubsub.lib.lua
+++ b/plugins/mod_pubsub/pubsub.lib.lua
@@ -328,9 +328,16 @@ function handlers.get_items(origin, stanza, items, service)
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 })