aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2024-11-08 02:12:45 +0100
committerKim Alvefur <zash@zash.se>2024-11-08 02:12:45 +0100
commite32aba4c5379e98d40e7f1a73dbb172f5a30c151 (patch)
tree8e97a4497e62d54a56b79d99e5c37721c529a4c5 /plugins/mod_pubsub
parent9005d35b4850dcde6d8fb4cba713f50a641a5b88 (diff)
downloadprosody-e32aba4c5379e98d40e7f1a73dbb172f5a30c151.tar.gz
prosody-e32aba4c5379e98d40e7f1a73dbb172f5a30c151.zip
mod_pubsub: Use new metadata method
No longer bypasses access control to retrieve this config subset, which is also explicitly named in the service config now.
Diffstat (limited to 'plugins/mod_pubsub')
-rw-r--r--plugins/mod_pubsub/mod_pubsub.lua7
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua25
2 files changed, 16 insertions, 16 deletions
diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua
index 6efc419f..c17d9e63 100644
--- a/plugins/mod_pubsub/mod_pubsub.lua
+++ b/plugins/mod_pubsub/mod_pubsub.lua
@@ -256,6 +256,13 @@ function module.load()
broadcaster = simple_broadcast;
itemcheck = is_item_stanza;
check_node_config = check_node_config;
+ metadata_subset = {
+ "title";
+ "description";
+ "payload_type";
+ "access_model";
+ "publish_model";
+ };
get_affiliation = get_affiliation;
jid = module.host;
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua
index 5a9be149..92586518 100644
--- a/plugins/mod_pubsub/pubsub.lib.lua
+++ b/plugins/mod_pubsub/pubsub.lib.lua
@@ -290,27 +290,20 @@ end
function _M.handle_disco_info_node(event, service)
local stanza, reply, node = event.stanza, event.reply, event.node;
- local ok, ret = service:get_nodes(stanza.attr.from);
+ local ok, meta = service:get_node_metadata(node, stanza.attr.from);
if not ok then
- event.origin.send(pubsub_error_reply(stanza, ret));
- return true;
- end
- local node_obj = ret[node];
- if not node_obj then
- event.origin.send(pubsub_error_reply(stanza, "item-not-found"));
+ event.origin.send(pubsub_error_reply(stanza, meta));
return true;
end
event.exists = true;
reply:tag("identity", { category = "pubsub", type = "leaf" }):up();
- if node_obj.config then
- reply:add_child(node_metadata_form:form({
- ["pubsub#title"] = node_obj.config.title;
- ["pubsub#description"] = node_obj.config.description;
- ["pubsub#type"] = node_obj.config.payload_type;
- ["pubsub#access_model"] = node_obj.config.access_model;
- ["pubsub#publish_model"] = node_obj.config.publish_model;
- }, "result"));
- end
+ reply:add_child(node_metadata_form:form({
+ ["pubsub#title"] = meta.title;
+ ["pubsub#description"] = meta.description;
+ ["pubsub#type"] = meta.payload_type;
+ ["pubsub#access_model"] = meta.access_model;
+ ["pubsub#publish_model"] = meta.publish_model;
+ }, "result"));
end
function _M.handle_disco_items_node(event, service)