|
|
|
@ -24,6 +24,7 @@ var CRLF = '\r\n',
|
|
|
|
|
RE_LITHEADER = /(?:((?:BODY\[.*\](?:<\d+>)?)?|[^ ]+) )?\{(\d+)\}$/i,
|
|
|
|
|
RE_UNRESP = /^\* (OK|PREAUTH|NO|BAD) (?:\[(.+)\] )?(.+)$/i,
|
|
|
|
|
//RE_ISPARTIAL = /<(\d+)>$/,
|
|
|
|
|
RE_DBLQ = /"/g,
|
|
|
|
|
RE_CMD = /^([^ ]+)(?: |$)/,
|
|
|
|
|
RE_ISHEADER = /HEADER/,
|
|
|
|
|
REX_UNRESPDATA = XRegExp('^\\* (?:(?:(?<type>NAMESPACE) (?<personal>(?:NIL|\\((?:\\(.+\\))+\\))) (?<other>(?:NIL|\\((?:\\(.+\\))+\\))) (?<shared>(?:NIL|\\((?:\\(.+\\))+\\))))|(?:(?<type>FLAGS) \\((?<flags>.*)\\))|(?:(?<type>LIST|LSUB|XLIST) \\((?<flags>.*)\\) (?<delimiter>".+"|NIL) (?<mailbox>.+))|(?:(?<type>(SEARCH|SORT))(?: (?<results>.*))?)|(?:(?<type>STATUS) (?<mailbox>.+) \\((?<attributes>.*)\\))|(?:(?<type>CAPABILITY) (?<capabilities>.+))|(?:(?<type>BYE) (?:\\[(?<code>.+)\\] )?(?<message>.+)))$', 'i'),
|
|
|
|
@ -210,13 +211,13 @@ ImapConnection.prototype.connect = function(loginCb) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function emitLitData(key, data) {
|
|
|
|
|
var fetches = requests[0].fetchers[key];
|
|
|
|
|
var fetches = requests[0].fetchers[key.replace(RE_DBLQ, '')];
|
|
|
|
|
for (var i=0, len=fetches.length; i<len; ++i)
|
|
|
|
|
fetches[i]._msg.emit('data', data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function emitLitMsg(key, msg) {
|
|
|
|
|
var fetches = requests[0].fetchers[key];
|
|
|
|
|
var fetches = requests[0].fetchers[key.replace(RE_DBLQ, '')];
|
|
|
|
|
for (var i=0, len=fetches.length; i<len; ++i) {
|
|
|
|
|
if (!fetches[i]._msg) {
|
|
|
|
|
fetches[i]._msg = msg;
|
|
|
|
@ -226,7 +227,7 @@ ImapConnection.prototype.connect = function(loginCb) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function emitMsgEnd(key) {
|
|
|
|
|
var fetches = requests[0].fetchers[key];
|
|
|
|
|
var fetches = requests[0].fetchers[key.replace(RE_DBLQ, '')];
|
|
|
|
|
for (var i=0, len=fetches.length; i<len; ++i) {
|
|
|
|
|
if (fetches[i]._msg) {
|
|
|
|
|
fetches[i]._msg.emit('end');
|
|
|
|
|