mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-01-01 05:06:44 +08:00
index List-ID headers
This commit is contained in:
parent
59de74a312
commit
3fb0b13a79
1 changed files with 13 additions and 1 deletions
|
@ -14,7 +14,7 @@ const openpgp = require('openpgp');
|
|||
const parseDate = require('../imap-core/lib/parse-date');
|
||||
|
||||
// index only the following headers for SEARCH
|
||||
const INDEXED_HEADERS = ['to', 'cc', 'subject', 'from', 'sender', 'reply-to', 'message-id', 'thread-index'];
|
||||
const INDEXED_HEADERS = ['to', 'cc', 'subject', 'from', 'sender', 'reply-to', 'message-id', 'thread-index', 'list-id'];
|
||||
|
||||
openpgp.config.commentstring = 'Plaintext message encrypted by WildDuck Mail Server';
|
||||
|
||||
|
@ -1218,6 +1218,18 @@ class MessageHandler {
|
|||
// store indexed value as lowercase for easier SEARCHing
|
||||
value = value.toLowerCase();
|
||||
|
||||
switch (key) {
|
||||
case 'list-id':
|
||||
// only index the actual ID of the list
|
||||
if (value.indexOf('<') >= 0) {
|
||||
let m = value.match(/<([^>]+)/);
|
||||
if (m && m[1] && m[1].trim()) {
|
||||
value = m[1].trim();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// trim long values as mongodb indexed fields can not be too long
|
||||
if (Buffer.byteLength(key, 'utf-8') >= 255) {
|
||||
key = Buffer.from(key)
|
||||
|
|
Loading…
Reference in a new issue