Use XLIST on instead of LIST if supported by server and stop filtering mailbox attributes when parsing the response.

fork
Bruno Morency 13 years ago committed by Brian White
parent 7e3eb1059b
commit 1b50f88949

@ -97,7 +97,7 @@ ImapConnection.prototype.connect = function(loginCb) {
} }
// Lastly, get the top-level mailbox hierarchy delimiter used by the // Lastly, get the top-level mailbox hierarchy delimiter used by the
// server // server
self._send('LIST "" ""', loginCb); self._send(((self.capabilities.indexOf('XLIST') == -1) ? 'LIST' : 'XLIST') + ' "" ""', loginCb);
}); });
}); });
}; };
@ -334,6 +334,7 @@ ImapConnection.prototype.connect = function(loginCb) {
self._state.requests[0].args.push(parseInt(result[1])); self._state.requests[0].args.push(parseInt(result[1]));
break;*/ break;*/
case 'LIST': case 'LIST':
case 'XLIST':
var result; var result;
if (self.delim === null if (self.delim === null
&& (result = /^\(\\No[sS]elect\) (.+?) .*$/.exec(data[2]))) && (result = /^\(\\No[sS]elect\) (.+?) .*$/.exec(data[2])))
@ -346,9 +347,9 @@ ImapConnection.prototype.connect = function(loginCb) {
var box = { var box = {
attribs: result[1].split(' ').map(function(attrib) { attribs: result[1].split(' ').map(function(attrib) {
return attrib.substr(1).toUpperCase(); return attrib.substr(1).toUpperCase();
}).filter(function(attrib) { })/*.filter(function(attrib) {
return (BOX_ATTRIBS.indexOf(attrib) > -1); return (BOX_ATTRIBS.indexOf(attrib) > -1);
}), })*/,
delim: (result[2] === 'NIL' delim: (result[2] === 'NIL'
? false : result[2].substring(1, result[2].length-1)), ? false : result[2].substring(1, result[2].length-1)),
children: null, children: null,
@ -588,7 +589,7 @@ ImapConnection.prototype.getBoxes = function(namespace, cb) {
cb = arguments[arguments.length-1]; cb = arguments[arguments.length-1];
if (arguments.length !== 2) if (arguments.length !== 2)
namespace = ''; namespace = '';
this._send('LIST "' + escape(namespace) + '" "*"', cb); this._send(((this.capabilities.indexOf('XLIST') == -1) ? 'LIST' : 'XLIST') + ' "' + escape(namespace) + '" "*"', cb);
}; };
ImapConnection.prototype.addBox = function(name, cb) { ImapConnection.prototype.addBox = function(name, cb) {

Loading…
Cancel
Save