diff options
-rw-r--r-- | plugins/mod_pubsub/mod_pubsub.lua | 7 | ||||
-rw-r--r-- | plugins/mod_pubsub/pubsub.lib.lua | 25 |
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) |