Software /
code /
prosody
Diff
plugins/mod_pubsub/pubsub.lib.lua @ 13550:eae0272b87e3
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 08 Nov 2024 02:12:45 +0100 |
parent | 13535:88cab98aa28c |
child | 13551:e17ff906d71b |
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua Fri Nov 08 02:11:00 2024 +0100 +++ b/plugins/mod_pubsub/pubsub.lib.lua Fri Nov 08 02:12:45 2024 +0100 @@ -290,27 +290,20 @@ 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)