mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-01-03 22:53:00 +08:00
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
// MOVE / UID MOVE sequence mailbox
|
|
module.exports = (server, messageHandler) => (path, update, session, callback) => {
|
|
server.logger.debug(
|
|
{
|
|
tnx: 'move',
|
|
cid: session.id
|
|
},
|
|
'[%s] Moving messages from "%s" to "%s"',
|
|
session.id,
|
|
path,
|
|
update.destination
|
|
);
|
|
|
|
messageHandler.move(
|
|
{
|
|
user: session.user.id,
|
|
// folder to move messages from
|
|
source: {
|
|
user: session.user.id,
|
|
path
|
|
},
|
|
// folder to move messages to
|
|
destination: {
|
|
user: session.user.id,
|
|
path: update.destination
|
|
},
|
|
session,
|
|
// list of UIDs to move
|
|
messages: update.messages
|
|
},
|
|
(...args) => {
|
|
if (args[0]) {
|
|
if (args[0].imapResponse) {
|
|
return callback(null, args[0].imapResponse);
|
|
}
|
|
return callback(args[0]);
|
|
}
|
|
callback(...args);
|
|
}
|
|
);
|
|
};
|