diff options
Diffstat (limited to 'common/mailpreprocessor.cpp')
-rw-r--r-- | common/mailpreprocessor.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/common/mailpreprocessor.cpp b/common/mailpreprocessor.cpp index 7bc80cd..3d5dc65 100644 --- a/common/mailpreprocessor.cpp +++ b/common/mailpreprocessor.cpp | |||
@@ -91,24 +91,24 @@ void MailPropertyExtractor::updatedIndexedProperties(Sink::ApplicationDomain::Ma | |||
91 | mail.setExtractedBcc(getContactList(msg->bcc(true))); | 91 | mail.setExtractedBcc(getContactList(msg->bcc(true))); |
92 | mail.setExtractedDate(msg->date(true)->dateTime()); | 92 | mail.setExtractedDate(msg->date(true)->dateTime()); |
93 | 93 | ||
94 | //Ensure the mssageId is unique. | 94 | const auto parentMessageId = [&] { |
95 | //If there already is one with the same id we'd have to assign a new message id, which probably doesn't make any sense. | 95 | //The last is the parent |
96 | 96 | auto references = msg->references(true)->identifiers(); | |
97 | //The last is the parent | 97 | |
98 | auto references = msg->references(true)->identifiers(); | 98 | //The first is the parent |
99 | 99 | auto inReplyTo = msg->inReplyTo(true)->identifiers(); | |
100 | //The first is the parent | 100 | |
101 | auto inReplyTo = msg->inReplyTo(true)->identifiers(); | 101 | if (!references.isEmpty()) { |
102 | QByteArray parentMessageId; | 102 | return references.last(); |
103 | if (!references.isEmpty()) { | 103 | //TODO we could use the rest of the references header to complete the ancestry in case we have missing parents. |
104 | parentMessageId = references.last(); | 104 | } else { |
105 | //TODO we could use the rest of the references header to complete the ancestry in case we have missing parents. | 105 | if (!inReplyTo.isEmpty()) { |
106 | } else { | 106 | //According to RFC5256 we should ignore all but the first |
107 | if (!inReplyTo.isEmpty()) { | 107 | return inReplyTo.first(); |
108 | //According to RFC5256 we should ignore all but the first | 108 | } |
109 | parentMessageId = inReplyTo.first(); | ||
110 | } | 109 | } |
111 | } | 110 | return QByteArray{}; |
111 | }(); | ||
112 | 112 | ||
113 | //The rest should never change, unless we didn't have the headers available initially. | 113 | //The rest should never change, unless we didn't have the headers available initially. |
114 | auto messageId = msg->messageID(true)->identifier(); | 114 | auto messageId = msg->messageID(true)->identifier(); |