|
|
|
@ -18,7 +18,6 @@ var CRLF = '\r\n',
|
|
|
|
|
BOXSELECTING: 3,
|
|
|
|
|
BOXSELECTED: 4
|
|
|
|
|
},
|
|
|
|
|
BOX_ATTRIBS = ['NOINFERIORS', 'NOSELECT', 'MARKED', 'UNMARKED'],
|
|
|
|
|
RE_LITHEADER = /(?:((?:BODY\[.*\])?|[^ ]+) )?\{(\d+)\}$/i,
|
|
|
|
|
RE_UNRESP = /^\* (OK|PREAUTH|NO|BAD) (?:\[(.+)\] )?(.+)$/i,
|
|
|
|
|
RE_CMD = /^([A-Za-z]+)(?: |$)/i,
|
|
|
|
@ -363,7 +362,6 @@ ImapConnection.prototype.connect = function(loginCb) {
|
|
|
|
|
m.flags = (m.flags ? m.flags.toUpperCase().split(' ') : []);
|
|
|
|
|
m.delimiter = parsers.convStr(m.delimiter, indata.literals);
|
|
|
|
|
m.mailbox = parsers.convStr(m.mailbox, indata.literals);
|
|
|
|
|
var result;
|
|
|
|
|
if (self.delimiter === undefined)
|
|
|
|
|
self.delimiter = parsers.convStr(m.delimiter, indata.literals);
|
|
|
|
|
else {
|
|
|
|
@ -663,7 +661,6 @@ ImapConnection.prototype.closeBox = function(cb) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ImapConnection.prototype.status = function(boxName, cb) {
|
|
|
|
|
var self = this;
|
|
|
|
|
if (this._state.status === STATES.BOXSELECTED
|
|
|
|
|
&& this._state.box.name === boxName)
|
|
|
|
|
throw new Error('Not allowed to call status on the currently selected mailbox');
|
|
|
|
@ -738,7 +735,7 @@ ImapConnection.prototype.append = function(data, options, cb) {
|
|
|
|
|
var cmd = 'APPEND "' + utils.escape(options.mailbox) + '"';
|
|
|
|
|
if ('flags' in options) {
|
|
|
|
|
if (!Array.isArray(options.flags))
|
|
|
|
|
options.flags = Array(options.flags);
|
|
|
|
|
options.flags = [options.flags];
|
|
|
|
|
cmd += " (\\" + options.flags.join(' \\') + ")";
|
|
|
|
|
}
|
|
|
|
|
if ('date' in options) {
|
|
|
|
@ -817,7 +814,7 @@ ImapConnection.prototype._fetch = function(which, uids, options) {
|
|
|
|
|
throw new Error("Expected Array of length 2 for body byte range");
|
|
|
|
|
else if (typeof opts.request.body[1] !== 'string'
|
|
|
|
|
|| !(rangeInfo = /^([\d]+)\-([\d]+)$/.exec(opts.request.body[1]))
|
|
|
|
|
|| parseInt(rangeInfo[1], 10) >= parseInt(rangeInfo[2]), 10)
|
|
|
|
|
|| parseInt(rangeInfo[1], 10) >= parseInt(rangeInfo[2], 10))
|
|
|
|
|
throw new Error("Invalid body byte range format");
|
|
|
|
|
bodyRange = '<' + parseInt(rangeInfo[1], 10) + '.'
|
|
|
|
|
+ parseInt(rangeInfo[2], 10) + '>';
|
|
|
|
@ -1175,7 +1172,7 @@ ImapConnection.prototype._send = function(cmdstr, cb, bypass) {
|
|
|
|
|
this._state.ext.idle.state = IDLE_WAIT;
|
|
|
|
|
}
|
|
|
|
|
if (cmd !== 'IDLE' && cmd !== 'DONE')
|
|
|
|
|
prefix = 'A' + ++this._state.curId + ' ';
|
|
|
|
|
prefix = 'A' + (++this._state.curId) + ' ';
|
|
|
|
|
this._state.conn.cleartext.write(prefix);
|
|
|
|
|
this._state.conn.cleartext.write(cmd);
|
|
|
|
|
this._state.conn.cleartext.write(CRLF);
|
|
|
|
|