lib: add support for retrieving special-use mailboxes

fork
Craig Paterson 9 years ago committed by Brian White
parent f74f257932
commit 3051724f85

@ -361,6 +361,10 @@ Connection.prototype.append = function(data, options, cb) {
this._queue[this._queue.length - 1].appendData = data;
};
Connection.prototype.getSpecialUseBoxes = function(cb) {
this._enqueue('XLIST "" "*"', cb);
};
Connection.prototype.getBoxes = function(namespace, cb) {
if (typeof namespace === 'function') {
cb = namespace;
@ -1328,7 +1332,7 @@ Connection.prototype._resUntagged = function(info) {
} else if (typeof info.textCode === 'string'
&& info.textCode.toUpperCase() === 'UIDVALIDITY')
this.emit('uidvalidity', info.text);
} else if (type === 'list' || type === 'lsub') {
} else if (type === 'list' || type === 'lsub' || type === 'xlist') {
if (this.delimiter === undefined)
this.delimiter = info.text.delimiter;
else {

@ -17,7 +17,7 @@ var CH_LF = 10,
RE_SEQNO = /^\* (\d+)/,
RE_LISTCONTENT = /^\((.*)\)$/,
RE_LITERAL = /\{(\d+)\}$/,
RE_UNTAGGED = /^\* (?:(OK|NO|BAD|BYE|FLAGS|ID|LIST|LSUB|SEARCH|STATUS|CAPABILITY|NAMESPACE|PREAUTH|SORT|THREAD|ESEARCH|QUOTA|QUOTAROOT)|(\d+) (EXPUNGE|FETCH|RECENT|EXISTS))(?:(?: \[([^\]]+)\])?(?: (.+))?)?$/i,
RE_UNTAGGED = /^\* (?:(OK|NO|BAD|BYE|FLAGS|ID|LIST|XLIST|LSUB|SEARCH|STATUS|CAPABILITY|NAMESPACE|PREAUTH|SORT|THREAD|ESEARCH|QUOTA|QUOTAROOT)|(\d+) (EXPUNGE|FETCH|RECENT|EXISTS))(?:(?: \[([^\]]+)\])?(?: (.+))?)?$/i,
RE_TAGGED = /^A(\d+) (OK|NO|BAD) (?:\[([^\]]+)\] )?(.+)$/i,
RE_CONTINUE = /^\+(?: (?:\[([^\]]+)\] )?(.+))?$/i,
RE_CRLF = /\r\n/g,
@ -247,7 +247,7 @@ Parser.prototype._resUntagged = function() {
val = parseExpr(m[5], this._literals);
else
val = [];
} else if (type === 'list' || type === 'lsub')
} else if (type === 'list' || type === 'lsub' || type === 'xlist')
val = parseBoxList(m[5], this._literals);
else if (type === 'id')
val = parseId(m[5], this._literals);
@ -889,7 +889,7 @@ function decodeWords(str, state) {
state.replaces = [];
var bytes, m, next, i, j, leni, lenj, seq, replaces = [], lastReplace = {};
// join consecutive q-encoded words that have the same charset first
while (m = RE_ENCWORD.exec(str)) {
seq = {

@ -133,6 +133,19 @@ var CR = '\r', LF = '\n', CRLF = CR + LF;
],
what: 'Search'
},
{ source: ['* XLIST (\\Noselect) "/" ~/Mail/foo', CRLF],
expected: [ { type: 'xlist',
num: undefined,
textCode: undefined,
text: {
flags: [ '\\Noselect' ],
delimiter: '/',
name: '~/Mail/foo'
}
}
],
what: 'XList'
},
{ source: ['* LIST (\\Noselect) "/" ~/Mail/foo', CRLF],
expected: [ { type: 'list',
num: undefined,

Loading…
Cancel
Save