comparison modules/mod_manage.js @ 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 c2c9c06d6e9d
children
comparison
equal deleted inserted replaced
57:addbf6bbfaa8 58:b98e545a94f7
101 if (affil != 'super-owner' && affil != 'owner') 101 if (affil != 'super-owner' && affil != 'owner')
102 return makeError(response, errors.forbidden.n); 102 return makeError(response, errors.forbidden.n);
103 103
104 var e = false; 104 var e = false;
105 var tags2 = []; 105 var tags2 = [];
106 for (i in request.tags) { 106 for (i in request.children) {
107 var tag = request.tags[i]; 107 var tag = request.children[i];
108 var jid = tag.getAttribute('jid'); 108 var jid = tag.getAttribute('jid');
109 var sub = tag.getAttribute('subscription'); 109 var sub = tag.getAttribute('subscription');
110 110
111 if (sub == 'none' || sub == 'pending' || sub == 'subscribed' || sub == 'unconfigured') { 111 if (sub == 'none' || sub == 'pending' || sub == 'subscribed' || sub == 'unconfigured') {
112 var set = storage.subscribe(nodeID, jid, sub); 112 var set = storage.subscribe(nodeID, jid, sub);
122 e = true; 122 e = true;
123 tags2.push(tag); 123 tags2.push(tag);
124 } 124 }
125 } 125 }
126 126
127 request.tags = tags2; 127 request.children = tags2;
128 128
129 if (e) 129 if (e)
130 return makeError(response, errors.owner.manage_subscriptions.modify.multiple_simultaneous_modifications.n, pubsub); 130 return makeError(response, errors.owner.manage_subscriptions.modify.multiple_simultaneous_modifications.n, pubsub);
131 131
132 return response; 132 return response;
152 var affil = storage.getAffiliation(JID.toBare(to), nodeID); 152 var affil = storage.getAffiliation(JID.toBare(to), nodeID);
153 if (affil != 'super-owner' && affil != 'owner') 153 if (affil != 'super-owner' && affil != 'owner')
154 return makeError(response, errors.forbidden.n); 154 return makeError(response, errors.forbidden.n);
155 155
156 var e = false; 156 var e = false;
157 for (var i in request.tags) { 157 for (var i in request.children) {
158 var jid = request.tags[i].getAttribute('jid'); 158 var jid = request.children[i].getAttribute('jid');
159 var affiliation = request.tags[i].getAttribute('affiliation'); 159 var affiliation = request.children[i].getAttribute('affiliation');
160 160
161 var set = storage.setAffiliation(nodeID, jid, affiliation); 161 var set = storage.setAffiliation(nodeID, jid, affiliation);
162 if (typeof set == 'number') 162 if (typeof set == 'number')
163 e = true; 163 e = true;
164 else { 164 else {
165 // SECTION 8.9.4 165 // SECTION 8.9.4
166 notifs.send(jid, 'affiliations', nodeID, {jid: jid, affiliation: affiliation}); 166 notifs.send(jid, 'affiliations', nodeID, {jid: jid, affiliation: affiliation});
167 request.tags.splice(i, 1); 167 request.children.splice(i, 1);
168 } 168 }
169 } 169 }
170 170
171 if (e) 171 if (e)
172 return makeError(response, errors.owner.manage_affiliations.modify.multiple_simultaneous_modifications.n, pubsub); 172 return makeError(response, errors.owner.manage_affiliations.modify.multiple_simultaneous_modifications.n, pubsub);