From b786c82eec3c944d61c5e7676b8c8d7373d60a82 Mon Sep 17 00:00:00 2001 From: mscdex Date: Sun, 7 Apr 2013 01:05:50 -0400 Subject: [PATCH] fix style in move() --- lib/imap.js | 73 +++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/lib/imap.js b/lib/imap.js index 014e799..8f842ab 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -1338,46 +1338,47 @@ 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, info, reentryCount, deletedUIDs, - counter) { - if (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, info, 1, result); - }); - } else if (reentryCount === 1) { - if (counter < deletedUIDs.length) { - self.delFlags(deletedUIDs[counter], 'Deleted', function(e) { - process.nextTick(function() { - ccb(e, info, reentryCount, deletedUIDs, counter + 1); - }); + this._copy(which, uids, boxTo, + function ccb(err, info, reentryCount, deletedUIDs, counter) { + if (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, info, 1, result); }); - } else - ccb(err, info, reentryCount + 1, deletedUIDs); - } else if (reentryCount === 2) { - self.addFlags(uids, 'Deleted', function(e) { - ccb(e, info, reentryCount + 1, deletedUIDs); - }); - } else if (reentryCount === 3) { - self.removeDeleted(function(e) { - 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, info, reentryCount, deletedUIDs, counter + 1); + } else if (reentryCount === 1) { + if (counter < deletedUIDs.length) { + self.delFlags(deletedUIDs[counter], 'Deleted', function(e) { + process.nextTick(function() { + ccb(e, info, reentryCount, deletedUIDs, counter + 1); + }); }); + } else + ccb(err, info, reentryCount + 1, deletedUIDs); + } else if (reentryCount === 2) { + self.addFlags(uids, 'Deleted', function(e) { + ccb(e, info, reentryCount + 1, deletedUIDs); }); - } else - cb(err, info); + } else if (reentryCount === 3) { + self.removeDeleted(function(e) { + 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, info, reentryCount, deletedUIDs, counter + 1); + }); + }); + } else + cb(err, info); + } } - }); + ); } };