|
|
|
@ -661,13 +661,18 @@ ImapConnection.prototype.connect = function(loginCb) {
|
|
|
|
|
var args = requests[0].cbargs,
|
|
|
|
|
cmdstr = requests[0].cmdstr;
|
|
|
|
|
if (!m) {
|
|
|
|
|
if (requests[0].cmd !== 'APPEND') {
|
|
|
|
|
err = new Error('Unexpected continuation');
|
|
|
|
|
if (requests[0].cmd === 'APPEND')
|
|
|
|
|
return requests[0].callback();
|
|
|
|
|
else {
|
|
|
|
|
var isXOAuth2 = (cmdstr.indexOf('AUTHENTICATE XOAUTH2') === 0),
|
|
|
|
|
msg = (isXOAuth2
|
|
|
|
|
? new Buffer(line.substr(2), 'base64').toString('utf8')
|
|
|
|
|
: 'Unexpected continuation');
|
|
|
|
|
err = new Error(msg);
|
|
|
|
|
err.level = 'protocol';
|
|
|
|
|
err.type = 'continuation';
|
|
|
|
|
err.type = (isXOAuth2 ? 'failure' : 'continuation');
|
|
|
|
|
err.request = cmdstr;
|
|
|
|
|
} else
|
|
|
|
|
return requests[0].callback();
|
|
|
|
|
}
|
|
|
|
|
} else if (m[1] !== 'OK') {
|
|
|
|
|
// m[1]: error type
|
|
|
|
|
// m[2]: resp-text-code
|
|
|
|
|