|
|
@ -661,13 +661,18 @@ ImapConnection.prototype.connect = function(loginCb) {
|
|
|
|
var args = requests[0].cbargs,
|
|
|
|
var args = requests[0].cbargs,
|
|
|
|
cmdstr = requests[0].cmdstr;
|
|
|
|
cmdstr = requests[0].cmdstr;
|
|
|
|
if (!m) {
|
|
|
|
if (!m) {
|
|
|
|
if (requests[0].cmd !== 'APPEND') {
|
|
|
|
if (requests[0].cmd === 'APPEND')
|
|
|
|
err = new Error('Unexpected continuation');
|
|
|
|
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.level = 'protocol';
|
|
|
|
err.type = 'continuation';
|
|
|
|
err.type = (isXOAuth2 ? 'failure' : 'continuation');
|
|
|
|
err.request = cmdstr;
|
|
|
|
err.request = cmdstr;
|
|
|
|
} else
|
|
|
|
}
|
|
|
|
return requests[0].callback();
|
|
|
|
|
|
|
|
} else if (m[1] !== 'OK') {
|
|
|
|
} else if (m[1] !== 'OK') {
|
|
|
|
// m[1]: error type
|
|
|
|
// m[1]: error type
|
|
|
|
// m[2]: resp-text-code
|
|
|
|
// m[2]: resp-text-code
|
|
|
|