Comparison

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
comparison
equal deleted inserted replaced
9121:e5eb36ee07a2 9122:a69dc9c729ec
660 local config_form = config:get_child("x", "jabber:x:data"); 660 local config_form = config:get_child("x", "jabber:x:data");
661 if not config_form then 661 if not config_form then
662 origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing dataform")); 662 origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing dataform"));
663 return true; 663 return true;
664 end 664 end
665 local form_data, err = node_config_form:data(config_form); 665 local ok, old_config = service:get_node_config(node, stanza.attr.from);
666 if not ok then
667 origin.send(pubsub_error_reply(stanza, old_config));
668 return true;
669 end
670 local form_data, err = node_config_form:data(config_form, old_config);
666 if not form_data then 671 if not form_data then
667 origin.send(st.error_reply(stanza, "modify", "bad-request", err)); 672 origin.send(st.error_reply(stanza, "modify", "bad-request", err));
668 return true; 673 return true;
669 end 674 end
670 local new_config = config_from_xep0060(form_data); 675 local new_config = config_from_xep0060(form_data);