Mercurial > prosody-hg
comparison plugins/mod_pubsub/pubsub.lib.lua @ 8317:ff57b3cc5a8e
mod_pubsub: Make sure that a dataform is given to configure
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 11 Oct 2017 22:18:26 +0200 |
| parents | ab189d3f55d1 |
| children | d0a7fc7614de |
comparison
equal
deleted
inserted
replaced
| 8316:8648cb171213 | 8317:ff57b3cc5a8e |
|---|---|
| 292 end | 292 end |
| 293 if not service:may(node, stanza.attr.from, "configure") then | 293 if not service:may(node, stanza.attr.from, "configure") then |
| 294 origin.send(pubsub_error_reply(stanza, "forbidden")); | 294 origin.send(pubsub_error_reply(stanza, "forbidden")); |
| 295 return true; | 295 return true; |
| 296 end | 296 end |
| 297 local new_config, err = node_config_form:data(config.tags[1]); | 297 local config_form = config:get_child("x", "jabber:x:data"); |
| 298 if not config_form then | |
| 299 origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing dataform")); | |
| 300 return true; | |
| 301 end | |
| 302 local new_config, err = node_config_form:data(config_form); | |
| 298 if not new_config then | 303 if not new_config then |
| 299 origin.send(st.error_reply(stanza, "modify", "bad-request", err)); | 304 origin.send(st.error_reply(stanza, "modify", "bad-request", err)); |
| 300 return true; | 305 return true; |
| 301 end | 306 end |
| 302 local ok, err = service:set_node_config(node, stanza.attr.from, new_config); | 307 local ok, err = service:set_node_config(node, stanza.attr.from, new_config); |
