Diff

plugins/mod_pubsub/pubsub.lib.lua @ 9122:a69dc9c729ec

mod_pubsub: Pass the current values to dataforms
author Kim Alvefur <zash@zash.se>
date Sun, 05 Aug 2018 15:52:19 +0200
parent 9120:01fc8ba0a7fa
child 9125:da7a2db01d6a
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua	Sun Aug 05 15:50:06 2018 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Sun Aug 05 15:52:19 2018 +0200
@@ -662,7 +662,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;