comparison modules/mod_owner.js @ 47:0d3f18bb1d36

Remove usage of fdsq.js in modules.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 10 Mar 2011 16:13:49 +0100
parents 023f767662d3
children 7e421278b31b
comparison
equal deleted inserted replaced
46:3126f8d6a5e3 47:0d3f18bb1d36
33 33
34 var nodeID = request.getAttribute('node'); 34 var nodeID = request.getAttribute('node');
35 if (!nodeID || nodeID == '') { 35 if (!nodeID || nodeID == '') {
36 if (!config.enabled('instant-nodes')) 36 if (!config.enabled('instant-nodes'))
37 return makeError(response, errors.owner.create.instant_nodes_not_supported.n); 37 return makeError(response, errors.owner.create.instant_nodes_not_supported.n);
38 nodeID = fdsq.makeRandomId(); 38 nodeID = makeRandomId();
39 instant = true; 39 instant = true;
40 } 40 }
41 if (storage.existsNode(nodeID)) 41 if (storage.existsNode(nodeID))
42 return makeError(response, errors.owner.create.nodeid_already_exists.n); 42 return makeError(response, errors.owner.create.nodeid_already_exists.n);
43 43
44 var bare = toBareJID(to); 44 var bare = JID.toBare(to);
45 var right = false; 45 var right = false;
46 46
47 // Check for super-owner 47 // Check for super-owner
48 for (var i in config.owner) 48 for (var i in config.owner)
49 if (config.owner[i] == bare) 49 if (config.owner[i] == bare)
86 if (!nodeID) 86 if (!nodeID)
87 return makeError(response, errors.nodeid_required.n); 87 return makeError(response, errors.nodeid_required.n);
88 if (!storage.existsNode(nodeID)) 88 if (!storage.existsNode(nodeID))
89 return makeError(response, errors.node_does_not_exist.n); 89 return makeError(response, errors.node_does_not_exist.n);
90 90
91 var affil = storage.getAffiliation(toBareJID(to), nodeID); 91 var affil = storage.getAffiliation(JID.toBare(to), nodeID);
92 if (affil != 'super-owner' && affil != 'owner') 92 if (affil != 'super-owner' && affil != 'owner')
93 return makeError(response, errors.forbidden.n); 93 return makeError(response, errors.forbidden.n);
94 94
95 var notifications = storage.deleteNode(nodeID); 95 var notifications = storage.deleteNode(nodeID);
96 if (typeof notifications == 'number') 96 if (typeof notifications == 'number')
116 if (!nodeID) 116 if (!nodeID)
117 return makeError(response, errors.nodeid_required.n); 117 return makeError(response, errors.nodeid_required.n);
118 if (!storage.existsNode(nodeID)) 118 if (!storage.existsNode(nodeID))
119 return makeError(response, errors.node_does_not_exist.n); 119 return makeError(response, errors.node_does_not_exist.n);
120 120
121 var affil = storage.getAffiliation(toBareJID(to), nodeID); 121 var affil = storage.getAffiliation(JID.toBare(to), nodeID);
122 if (affil != 'super-owner' && affil != 'owner') 122 if (affil != 'super-owner' && affil != 'owner')
123 return makeError(response, errors.forbidden.n); 123 return makeError(response, errors.forbidden.n);
124 124
125 if (!config.enabled('persistent-items')) //FIXME: autre condition, supporté par le node 125 if (!config.enabled('persistent-items')) //FIXME: autre condition, supporté par le node
126 return makeError(response, errors.owner.purge.node_does_not_persist_items.n); 126 return makeError(response, errors.owner.purge.node_does_not_persist_items.n);