mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-01-07 16:38:17 +08:00
v1.15.0
This commit is contained in:
parent
f4e533e41d
commit
8f7b184cd1
4 changed files with 93 additions and 52 deletions
|
@ -524,6 +524,7 @@ class FilterHandler {
|
||||||
let messageOpts = {
|
let messageOpts = {
|
||||||
user: userData._id,
|
user: userData._id,
|
||||||
[mailboxQueryKey]: mailboxQueryValue,
|
[mailboxQueryKey]: mailboxQueryValue,
|
||||||
|
inboxDefault: true, // if mailbox is not found, then store to INBOX
|
||||||
|
|
||||||
prepared,
|
prepared,
|
||||||
maildata,
|
maildata,
|
||||||
|
|
|
@ -199,49 +199,67 @@ class MailboxHandler {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send information about deleted mailbox straightly to connected clients
|
// delete matching filters as well
|
||||||
this.notifier.fire(mailboxData.user, {
|
this.database.collection('filters').deleteOne(
|
||||||
command: 'DROP',
|
|
||||||
mailbox
|
|
||||||
});
|
|
||||||
|
|
||||||
this.notifier.addEntries(
|
|
||||||
mailboxData,
|
|
||||||
{
|
{
|
||||||
command: 'DELETE',
|
user,
|
||||||
mailbox
|
'action.mailbox': mailbox
|
||||||
},
|
},
|
||||||
() => {
|
err => {
|
||||||
this.database.collection('messages').updateMany(
|
if (err) {
|
||||||
{
|
this.loggelf({
|
||||||
|
user,
|
||||||
mailbox,
|
mailbox,
|
||||||
uid: {
|
action: 'delete_filter',
|
||||||
$gt: 0,
|
error: err.message
|
||||||
$lt: mailboxData.uidNext + 100
|
});
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
$set: {
|
|
||||||
exp: true,
|
|
||||||
// make sure the messages are in top of the expire queue
|
|
||||||
rdate: Date.now() - 24 * 3600 * 1000
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
multi: true,
|
|
||||||
w: 1
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
if (err) {
|
|
||||||
return callback(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
let done = () => {
|
// send information about deleted mailbox straightly to connected clients
|
||||||
this.notifier.fire(mailboxData.user);
|
this.notifier.fire(mailboxData.user, {
|
||||||
callback(null, true, mailbox);
|
command: 'DROP',
|
||||||
};
|
mailbox
|
||||||
|
});
|
||||||
|
|
||||||
return done();
|
this.notifier.addEntries(
|
||||||
|
mailboxData,
|
||||||
|
{
|
||||||
|
command: 'DELETE',
|
||||||
|
mailbox
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.database.collection('messages').updateMany(
|
||||||
|
{
|
||||||
|
mailbox,
|
||||||
|
uid: {
|
||||||
|
$gt: 0,
|
||||||
|
$lt: mailboxData.uidNext + 100
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$set: {
|
||||||
|
exp: true,
|
||||||
|
// make sure the messages are in top of the expire queue
|
||||||
|
rdate: Date.now() - 24 * 3600 * 1000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
multi: true,
|
||||||
|
w: 1
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
if (err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
let done = () => {
|
||||||
|
this.notifier.fire(mailboxData.user);
|
||||||
|
callback(null, true, mailbox);
|
||||||
|
};
|
||||||
|
|
||||||
|
return done();
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,18 +79,40 @@ class MessageHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.database.collection('mailboxes').findOne(query, (err, mailbox) => {
|
this.database.collection('mailboxes').findOne(query, (err, mailboxData) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mailbox) {
|
if (!mailboxData) {
|
||||||
|
if (options.path !== 'INBOX' && options.inboxDefault) {
|
||||||
|
return this.database.collection('mailboxes').findOne(
|
||||||
|
{
|
||||||
|
user: options.user,
|
||||||
|
path: 'INBOX'
|
||||||
|
},
|
||||||
|
(err, mailboxData) => {
|
||||||
|
if (err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mailboxData) {
|
||||||
|
let err = new Error('Mailbox is missing');
|
||||||
|
err.imapResponse = 'TRYCREATE';
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(null, mailboxData);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let err = new Error('Mailbox is missing');
|
let err = new Error('Mailbox is missing');
|
||||||
err.imapResponse = 'TRYCREATE';
|
err.imapResponse = 'TRYCREATE';
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(null, mailbox);
|
callback(null, mailboxData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
package.json
22
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "wildduck",
|
"name": "wildduck",
|
||||||
"version": "1.14.1",
|
"version": "1.15.0",
|
||||||
"description": "IMAP/POP3 server built with Node.js and MongoDB",
|
"description": "IMAP/POP3 server built with Node.js and MongoDB",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -15,13 +15,13 @@
|
||||||
"author": "Andris Reinman",
|
"author": "Andris Reinman",
|
||||||
"license": "EUPL-1.1+",
|
"license": "EUPL-1.1+",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ajv": "6.9.2",
|
"ajv": "6.10.0",
|
||||||
"apidoc": "0.17.7",
|
"apidoc": "0.17.7",
|
||||||
"browserbox": "0.9.1",
|
"browserbox": "0.9.1",
|
||||||
"chai": "4.2.0",
|
"chai": "4.2.0",
|
||||||
"eslint": "5.14.1",
|
"eslint": "5.15.3",
|
||||||
"eslint-config-nodemailer": "1.2.0",
|
"eslint-config-nodemailer": "1.2.0",
|
||||||
"eslint-config-prettier": "4.0.0",
|
"eslint-config-prettier": "4.1.0",
|
||||||
"grunt": "1.0.3",
|
"grunt": "1.0.3",
|
||||||
"grunt-cli": "1.3.2",
|
"grunt-cli": "1.3.2",
|
||||||
"grunt-eslint": "21.0.0",
|
"grunt-eslint": "21.0.0",
|
||||||
|
@ -29,8 +29,8 @@
|
||||||
"grunt-shell-spawn": "0.4.0",
|
"grunt-shell-spawn": "0.4.0",
|
||||||
"grunt-wait": "0.3.0",
|
"grunt-wait": "0.3.0",
|
||||||
"icedfrisby": "1.5.0",
|
"icedfrisby": "1.5.0",
|
||||||
"mailparser": "2.4.3",
|
"mailparser": "2.5.0",
|
||||||
"mocha": "^5.2.0",
|
"mocha": "5.2.0",
|
||||||
"request": "2.88.0"
|
"request": "2.88.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
"ioredis": "4.6.2",
|
"ioredis": "4.6.2",
|
||||||
"isemail": "3.2.0",
|
"isemail": "3.2.0",
|
||||||
"joi": "14.3.1",
|
"joi": "14.3.1",
|
||||||
"js-yaml": "3.12.1",
|
"js-yaml": "3.12.2",
|
||||||
"key-fingerprint": "1.1.0",
|
"key-fingerprint": "1.1.0",
|
||||||
"libbase64": "1.0.3",
|
"libbase64": "1.0.3",
|
||||||
"libmime": "4.0.1",
|
"libmime": "4.0.1",
|
||||||
|
@ -58,14 +58,14 @@
|
||||||
"mongo-cursor-pagination": "7.1.0",
|
"mongo-cursor-pagination": "7.1.0",
|
||||||
"mongodb": "3.1.13",
|
"mongodb": "3.1.13",
|
||||||
"mongodb-extended-json": "1.10.1",
|
"mongodb-extended-json": "1.10.1",
|
||||||
"node-forge": "0.8.1",
|
"node-forge": "0.8.2",
|
||||||
"nodemailer": "5.1.1",
|
"nodemailer": "5.1.1",
|
||||||
"npmlog": "4.1.2",
|
"npmlog": "4.1.2",
|
||||||
"openpgp": "4.4.7",
|
"openpgp": "4.4.10",
|
||||||
"pem": "1.14.2",
|
"pem": "1.14.2",
|
||||||
"pwnedpasswords": "1.0.4",
|
"pwnedpasswords": "1.0.4",
|
||||||
"qrcode": "1.3.3",
|
"qrcode": "1.3.3",
|
||||||
"restify": "8.0.0",
|
"restify": "8.2.0",
|
||||||
"restify-logger": "2.0.1",
|
"restify-logger": "2.0.1",
|
||||||
"seq-index": "1.1.0",
|
"seq-index": "1.1.0",
|
||||||
"smtp-server": "3.5.0",
|
"smtp-server": "3.5.0",
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
"utf7": "1.0.2",
|
"utf7": "1.0.2",
|
||||||
"uuid": "3.3.2",
|
"uuid": "3.3.2",
|
||||||
"wild-config": "1.4.0",
|
"wild-config": "1.4.0",
|
||||||
"yargs": "13.2.1"
|
"yargs": "13.2.2"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
Loading…
Reference in a new issue