Mercurial > psgxs
changeset 58:b98e545a94f7 default tip
Always use children instead of tags. Might break something.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 13 Sep 2011 00:54:55 +0200 |
parents | addbf6bbfaa8 |
children | |
files | forms.js modules/mod_configure.js modules/mod_manage.js modules/mod_publish.js |
diffstat | 4 files changed, 15 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/forms.js +++ b/forms.js @@ -114,8 +114,8 @@ exports.parse = function(x, params) { } form.fields = {}; - for (var i in x.tags) { - var field = x.tags[i]; + for (var i in x.children) { + var field = x.children[i]; var name = field.getAttribute('var'); if (params && name == 'FORM_TYPE') continue; @@ -124,8 +124,8 @@ exports.parse = function(x, params) { var type = field.getAttribute('type'); if (type == 'jid-multi' || type == 'list-multi' || type == 'text-multi') { form.fields[name] = []; - for (var j in field.tags) { - var elem = field.tags[j]; + for (var j in field.children) { + var elem = field.children[j]; if (elem.name == 'value') form.fields[name].push(elem.getText()); } @@ -152,8 +152,8 @@ exports.parse = function(x, params) { if (type == 'jid-multi' || type == 'list-multi' || type == 'text-multi') { form.fields[name].options = {}; form.fields[name].values = []; - for (var j in field.tags) { - var elem = field.tags[j]; + for (var j in field.children) { + var elem = field.children[j]; if (elem.name == 'option') { var value = elem.getChild('value'); if (!value)
--- a/modules/mod_configure.js +++ b/modules/mod_configure.js @@ -130,7 +130,7 @@ exports.setConfigure2 = { if (!config.enabled('config-node')) return makeError(response, errors.owner.configure.node_configuration_not_supported.n); - var nodeID = stanza.tags[0].tags[0].getAttribute('node'); + var nodeID = stanza.children[0].children[0].getAttribute('node'); if (!nodeID) return makeError(response, errors.nodeid_required.n); if (!storage.existsNode(nodeID))
--- a/modules/mod_manage.js +++ b/modules/mod_manage.js @@ -103,8 +103,8 @@ exports.modifySub = { var e = false; var tags2 = []; - for (i in request.tags) { - var tag = request.tags[i]; + for (i in request.children) { + var tag = request.children[i]; var jid = tag.getAttribute('jid'); var sub = tag.getAttribute('subscription'); @@ -124,7 +124,7 @@ exports.modifySub = { } } - request.tags = tags2; + request.children = tags2; if (e) return makeError(response, errors.owner.manage_subscriptions.modify.multiple_simultaneous_modifications.n, pubsub); @@ -154,9 +154,9 @@ exports.modifyAff = { return makeError(response, errors.forbidden.n); var e = false; - for (var i in request.tags) { - var jid = request.tags[i].getAttribute('jid'); - var affiliation = request.tags[i].getAttribute('affiliation'); + for (var i in request.children) { + var jid = request.children[i].getAttribute('jid'); + var affiliation = request.children[i].getAttribute('affiliation'); var set = storage.setAffiliation(nodeID, jid, affiliation); if (typeof set == 'number') @@ -164,7 +164,7 @@ exports.modifyAff = { else { // SECTION 8.9.4 notifs.send(jid, 'affiliations', nodeID, {jid: jid, affiliation: affiliation}); - request.tags.splice(i, 1); + request.children.splice(i, 1); } }
--- a/modules/mod_publish.js +++ b/modules/mod_publish.js @@ -53,7 +53,7 @@ exports.publish = { return makeError(response, errors.itemid_required.n); itemID = itemID? itemID: uuid(); - if (item.tags.length != 1) + if (item.children.length != 1) return makeError(response, errors.pub.publish.bad_payload.n); var conf = storage.getConfiguration(nodeID);