Software /
code /
prosody
Diff
plugins/mod_pubsub/pubsub.lib.lua @ 9125:da7a2db01d6a
Merge with jonasw
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 06 Aug 2018 08:21:55 +0100 |
parent | 9124:dcc490f0044d |
parent | 9122:a69dc9c729ec |
child | 9126:3dd5034a3233 |
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua Sun Aug 05 11:44:49 2018 +0200 +++ b/plugins/mod_pubsub/pubsub.lib.lua Mon Aug 06 08:21:55 2018 +0100 @@ -642,18 +642,12 @@ return true; end - if not service:may(node, stanza.attr.from, "configure") then - origin.send(pubsub_error_reply(stanza, "forbidden")); + local ok, node_config = service:get_node_config(node, stanza.attr.from); + if not ok then + origin.send(pubsub_error_reply(stanza, node_config)); return true; end - local node_obj = service.nodes[node]; - if not node_obj then - origin.send(pubsub_error_reply(stanza, "item-not-found")); - return true; - end - - local node_config = node_obj.config; local pubsub_form_data = config_to_xep0060(node_config); local reply = st.reply(stanza) :tag("pubsub", { xmlns = xmlns_pubsub_owner }) @@ -678,7 +672,12 @@ origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing dataform")); return true; end - local form_data, err = node_config_form:data(config_form); + local ok, old_config = service:get_node_config(node, stanza.attr.from); + if not ok then + origin.send(pubsub_error_reply(stanza, old_config)); + return true; + end + local form_data, err = node_config_form:data(config_form, old_config); if not form_data then origin.send(st.error_reply(stanza, "modify", "bad-request", err)); return true;