changeset 4:4c93e76fa371

Ensure that the creator of a node is the default owner; don’t crash when sending metadata.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 29 Jun 2010 13:38:07 +0200
parents 80e607c0b39e
children d8a98540d749
files nodes.js psgxs.js
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/nodes.js
+++ b/nodes.js
@@ -34,7 +34,11 @@ exports.Node = function(params) {
 	this.items = {};
 	if (config.enabled('subscribe'))
 		this.subscribers = {};
+
 	this.owner = [];
+	if (params && params['pubsub#creator'])
+		this.owner.push(params['pubsub#creator']);
+
 	if (config.enabled('publisher-affiliation'))
 		this.publisher = [];
 	if (config.enabled('publish-only-affiliation'))
--- a/psgxs.js
+++ b/psgxs.js
@@ -92,7 +92,7 @@ function onIq(stanza) {
 
 				// SECTION 5.4
 				if (config.enabled('meta-data')) {
-					var x = forms.build('result', 'meta-data', storage.getMetadata(nodeID), true);
+					var x = forms.build('result', 'node_metadata', storage.getMetadata(nodeID), true);
 					if (x)
 						q.cx(x);
 				}
@@ -669,7 +669,7 @@ function onIq(stanza) {
 
 				var nodeID = pubsub.getChild('create').getAttribute('node');
 				if (!nodeID || nodeID == '') {
-					if (config.enabled('instant-nodes'))
+					if (!config.enabled('instant-nodes'))
 						return makeError(response, errors.owner.create.instant_nodes_not_supported.n);
 					nodeID = utils.makeRandomId();
 					instant = true;
@@ -961,7 +961,7 @@ function sendNotifs(notifs, type, nodeID
 				args.jid = attr;
 		}
 		var affiliations = xmpp.stanza('affiliations', {node: nodeID})
-			.c('affiliation', {args});
+			.c('affiliation', args);
 		ev.cx(affiliations);
 	} else if (type == 'collection') {
 		var collection = xmpp.stanza('collection', {node: nodeID});