mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-11-05 22:20:13 +08:00
log archive action
This commit is contained in:
parent
a6ecb92e85
commit
a9262edfd9
1 changed files with 15 additions and 1 deletions
|
|
@ -514,7 +514,7 @@ class MessageHandler {
|
|||
messageData.exp = true;
|
||||
messageData.rdate = curtime.getTime() + consts.ARCHIVE_TIME;
|
||||
|
||||
this.database.collection('archived').insertOne(messageData, { w: 'majority' }, err => {
|
||||
this.database.collection('archived').insertOne(messageData, { w: 'majority' }, (err, r) => {
|
||||
if (err) {
|
||||
if (err.code === 11000) {
|
||||
// already archived, probably the same message from another mailbox
|
||||
|
|
@ -523,6 +523,20 @@ class MessageHandler {
|
|||
return callback(err);
|
||||
}
|
||||
|
||||
if (r && r.insertedCount) {
|
||||
this.loggelf({
|
||||
short_message: '[ARCHIVED]',
|
||||
_mail_action: 'archived',
|
||||
_user: messageData.user,
|
||||
_mailbox: messageData.mailbox,
|
||||
_uid: messageData.uid,
|
||||
_message_id: messageData._id,
|
||||
_expires: messageData.rdate,
|
||||
_session: options.session && options.session.id,
|
||||
_size: messageData.size
|
||||
});
|
||||
}
|
||||
|
||||
return next(null, true);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue