summaryrefslogtreecommitdiffstats
path: root/common/mailpreprocessor.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-06-19 10:29:20 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-06-19 11:15:19 +0200
commitb940489ed6afe413339a1c602d05f3b4f3133463 (patch)
tree84b79d47236d83d2e6ae1833105885a885e4ce99 /common/mailpreprocessor.cpp
parent077e3cb30ace5f6ee20ee15e0d32d2bfb197fde0 (diff)
downloadsink-b940489ed6afe413339a1c602d05f3b4f3133463.tar.gz
sink-b940489ed6afe413339a1c602d05f3b4f3133463.zip
Asserts, debug messages and other cleanup
Diffstat (limited to 'common/mailpreprocessor.cpp')
-rw-r--r--common/mailpreprocessor.cpp34
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();