+ origin.send(reply);
+ return true;
+end
+
+function handlers.get_configure(origin, stanza, config, service)
+ local node = config.attr.node;
+ if not node then
+ origin.send(pubsub_error_reply(stanza, "nodeid-required"));
+ return true;
+ end
+
+ if not service:may(node, stanza.attr.from, "configure") then
+ origin.send(pubsub_error_reply(stanza, "forbidden"));
+ 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 reply = st.reply(stanza)
+ :tag("pubsub", { xmlns = xmlns_pubsub_owner })
+ :tag("configure", { node = node })
+ :add_child(node_config_form:form(node_obj.config));
+ origin.send(reply);
+ return true;
+end
+
+function handlers.set_configure(origin, stanza, config, service)
+ local node = config.attr.node;
+ if not node then
+ origin.send(pubsub_error_reply(stanza, "nodeid-required"));
+ return true;
+ end
+ if not service:may(node, stanza.attr.from, "configure") then
+ origin.send(pubsub_error_reply(stanza, "forbidden"));
+ return true;
+ end
+ local new_config, err = node_config_form:data(config.tags[1]);
+ if not new_config then
+ origin.send(st.error_reply(stanza, "modify", "bad-request", err));
+ return true;
+ end
+ local ok, err = service:set_node_config(node, stanza.attr.from, new_config);
+ if not ok then
+ origin.send(pubsub_error_reply(stanza, err));
+ return true;
+ end
+ origin.send(st.reply(stanza));
+ return true;
+end
+
+function handlers.get_default(origin, stanza, default, service)
+ local reply = st.reply(stanza)
+ :tag("pubsub", { xmlns = xmlns_pubsub_owner })
+ :tag("default")
+ :add_child(node_config_form:form(service.node_defaults));
+ origin.send(reply);
+ return true;