From 6f2adf53e30b3e0f5efc1c010e8242c1eaeeeb38 Mon Sep 17 00:00:00 2001 From: Chotiwat Chawannakul Date: Fri, 29 Mar 2013 14:14:29 +0700 Subject: [PATCH] Pass response text code and message for tagged response in append and move --- lib/imap.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/imap.js b/lib/imap.js index cbc6549..6d8b81f 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -893,9 +893,9 @@ ImapConnection.prototype.append = function(data, options, cb) { cmd += (Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data)); cmd += '}'; var self = this, step = 1; - this._send(cmd, function(err) { + this._send(cmd, function(err, info) { if (err || step++ === 2) - return cb(err); + return cb(err, info); self._state.conn.write(data); self._state.conn.write(CRLF); self.debug&&self.debug('\n==> ' + inspect(data.toString()) + '\n'); @@ -1314,44 +1314,44 @@ ImapConnection.prototype._move = function(which, uids, boxTo, cb) { throw new Error('Cannot move message: ' + 'server does not allow deletion of messages'); } else { - this._copy(which, uids, boxTo, function ccb(err, reentryCount, deletedUIDs, + this._copy(which, uids, boxTo, function ccb(err, info, reentryCount, deletedUIDs, counter) { if (err) - return cb(err); + return cb(err, info); counter = counter || 0; // Make sure we don't expunge any messages marked as Deleted except the // one we are moving if (reentryCount === undefined) { self.search(['DELETED'], function(e, result) { - ccb(e, 1, result); + ccb(e, info, 1, result); }); } else if (reentryCount === 1) { if (counter < deletedUIDs.length) { self.delFlags(deletedUIDs[counter], 'Deleted', function(e) { process.nextTick(function() { - ccb(e, reentryCount, deletedUIDs, counter + 1); + ccb(e, info, reentryCount, deletedUIDs, counter + 1); }); }); } else - ccb(err, reentryCount + 1, deletedUIDs); + ccb(err, info, reentryCount + 1, deletedUIDs); } else if (reentryCount === 2) { self.addFlags(uids, 'Deleted', function(e) { - ccb(e, reentryCount + 1, deletedUIDs); + ccb(e, info, reentryCount + 1, deletedUIDs); }); } else if (reentryCount === 3) { self.removeDeleted(function(e) { - ccb(e, reentryCount + 1, deletedUIDs); + ccb(e, info, reentryCount + 1, deletedUIDs); }); } else if (reentryCount === 4) { if (counter < deletedUIDs.length) { self.addFlags(deletedUIDs[counter], 'Deleted', function(e) { process.nextTick(function() { - ccb(e, reentryCount, deletedUIDs, counter + 1); + ccb(e, info, reentryCount, deletedUIDs, counter + 1); }); }); } else - cb(); + cb(err, info); } }); }