|
|
|
@ -309,11 +309,24 @@ Connection.prototype.getBoxes = function(namespace, cb) {
|
|
|
|
|
Connection.prototype.id = function(identification, cb) {
|
|
|
|
|
if (!this.serverSupports('ID'))
|
|
|
|
|
throw new Error('Server does not support ID');
|
|
|
|
|
cmd = '';
|
|
|
|
|
for (var k in identification)
|
|
|
|
|
cmd += '"' + k + '" "' + identification[k] + '"';
|
|
|
|
|
return this._enqueue('ID (' + cmd + ')', cb);
|
|
|
|
|
}
|
|
|
|
|
var cmd = 'ID';
|
|
|
|
|
if (identification === null)
|
|
|
|
|
cmd += ' NIL';
|
|
|
|
|
else {
|
|
|
|
|
if (Object.keys(identification).length > 30)
|
|
|
|
|
throw new Error('Max allowed number of keys is 30');
|
|
|
|
|
cmd += ' (';
|
|
|
|
|
for (var k in identification) {
|
|
|
|
|
if (k.length > 30)
|
|
|
|
|
throw new Error('Max allowed key length is 30');
|
|
|
|
|
if (identification[k].length > 1024)
|
|
|
|
|
throw new Error('Max allowed value length is 1024');
|
|
|
|
|
cmd += '"' + escape(k) + '" "' + escape(identification[k]) + '"';
|
|
|
|
|
}
|
|
|
|
|
cmd += ')';
|
|
|
|
|
}
|
|
|
|
|
this._enqueue(cmd, cb);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Connection.prototype.openBox = function(name, readOnly, cb) {
|
|
|
|
|
if (this.state !== 'authenticated')
|
|
|
|
|