Changeset

6441:bcb1ea9047d3

mod_pubsub: Add support for requesting default node configuration
author Kim Alvefur <zash@zash.se>
date Sun, 28 Sep 2014 01:55:32 +0200
parents 6440:9619809bf50b
children 6442:0f4025abbe8f 6445:f1ad3923368c
files plugins/mod_pubsub/mod_pubsub.lua plugins/mod_pubsub/pubsub.lib.lua
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pubsub/mod_pubsub.lua	Sun Sep 28 01:50:17 2014 +0200
+++ b/plugins/mod_pubsub/mod_pubsub.lua	Sun Sep 28 01:55:32 2014 +0200
@@ -65,6 +65,7 @@
 	add_subscription = { "subscribe" };
 	get_subscriptions = { "retrieve-subscriptions" };
 	set_configure = { "config-node" };
+	get_default = { "retrieve-default" };
 };
 
 local function add_disco_features_from_service(service)
--- a/plugins/mod_pubsub/pubsub.lib.lua	Sun Sep 28 01:50:17 2014 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Sun Sep 28 01:55:32 2014 +0200
@@ -271,4 +271,12 @@
 	return origin.send(st.reply(stanza));
 end
 
+function handlers.get_default(origin, stanza, default, service)
+	local reply = st.reply(stanza)
+		:tag("pubsub", { xmlns = xmlns_pubsub_owner })
+			:tag("configure", { node = node })
+				:add_child(form:form(service.node_default_config));
+	return origin.send(reply);
+end
+
 return _M;