updated event handling

This commit is contained in:
Andris Reinman 2017-10-27 12:30:13 +03:00
parent a1b4431fb7
commit 498b96e0d6
6 changed files with 20 additions and 12 deletions

View file

@ -1,6 +1,6 @@
[example]
enabled = true
enabled = false
# $WD: path of wildduck module root
# $CONFIG: path of config root

View file

@ -370,7 +370,7 @@ class Indexer {
// remove attachments and very large text nodes from the mime tree
if (!isMultipart && node.body && node.body.length && (!isInlineText || node.size > 300 * 1024)) {
let attachmentId = 'ATT' + leftPad(++idcount, '0', 5);
let attachmentId = 'ATT' + (++idcount).toString().padStart(5, '0');
let fileName =
(node.parsedHeader['content-disposition'] &&
@ -784,8 +784,4 @@ function textToHtml(str) {
return text;
}
function leftPad(val, chr, len) {
return chr.repeat(len - val.toString().length) + val;
}
module.exports = Indexer;

View file

@ -365,6 +365,13 @@ indexes:
key:
id: hashed
- collection: messagelog
index:
name: messagelog_parent
key:
parentId: 1
sparse: true
- collection: messagelog
index:
name: messagelog_autoexpire

View file

@ -798,11 +798,11 @@ module.exports = (db, server, messageHandler) => {
let logQuery = false;
if (messageData.outbound && messageData.outbound.length === 1) {
logQuery = {
id: messageData.outbound[0]
$or: [{ id: messageData.outbound[0] }, { parentId: messageData._id }]
};
} else if (messageData.outbound && messageData.outbound.length > 1) {
logQuery = {
id: { $in: messageData.outbound }
$or: [{ id: { $in: messageData.outbound } }, { parentId: messageData._id }]
};
}
if (!logQuery) {
@ -831,6 +831,7 @@ module.exports = (db, server, messageHandler) => {
logEntries.map(entry => ({
id: entry.id,
seq: entry.seq,
stored: entry.parentId,
action: entry.action,
origin: entry.origin || entry.source,
src: entry.ip,

View file

@ -311,7 +311,11 @@ class FilterHandler {
recipient,
targets: forwardTargets.size
? Array.from(forwardTargets).map(row => ({ type: row[1].type, value: row[1].value }))
? Array.from(forwardTargets).map((row, i) => ({
type: row[1].type,
value: row[1].value,
seq: (i + 1).toString(16).padStart(3, '0')
}))
: false,
chunks,

View file

@ -297,16 +297,16 @@ class MessageHandler {
}
this.database.collection('messagelog').insertOne({
id: messageData.meta.queueId,
id: messageData.meta.queueId || messageData._id.toString(),
action: 'STORE',
parentId: messageData._id,
messageId: messageData.msgid,
'message-id': messageData.msgid,
source: messageData.meta.source,
origin: messageData.meta.origin,
from: messageData.meta.from,
to: messageData.meta.to,
transtype: messageData.meta.transtype,
time: messageData.meta.time || new Date()
created: messageData.meta.time || new Date()
}, () => {
let uidValidity = mailboxData.uidValidity;
let uid = messageData.uid;