From b940489ed6afe413339a1c602d05f3b4f3133463 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 19 Jun 2018 10:29:20 +0200 Subject: Asserts, debug messages and other cleanup --- common/mailpreprocessor.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'common/mailpreprocessor.cpp') 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 mail.setExtractedBcc(getContactList(msg->bcc(true))); mail.setExtractedDate(msg->date(true)->dateTime()); - //Ensure the mssageId is unique. - //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. - - //The last is the parent - auto references = msg->references(true)->identifiers(); - - //The first is the parent - auto inReplyTo = msg->inReplyTo(true)->identifiers(); - QByteArray parentMessageId; - if (!references.isEmpty()) { - parentMessageId = references.last(); - //TODO we could use the rest of the references header to complete the ancestry in case we have missing parents. - } else { - if (!inReplyTo.isEmpty()) { - //According to RFC5256 we should ignore all but the first - parentMessageId = inReplyTo.first(); + const auto parentMessageId = [&] { + //The last is the parent + auto references = msg->references(true)->identifiers(); + + //The first is the parent + auto inReplyTo = msg->inReplyTo(true)->identifiers(); + + if (!references.isEmpty()) { + return references.last(); + //TODO we could use the rest of the references header to complete the ancestry in case we have missing parents. + } else { + if (!inReplyTo.isEmpty()) { + //According to RFC5256 we should ignore all but the first + return inReplyTo.first(); + } } - } + return QByteArray{}; + }(); //The rest should never change, unless we didn't have the headers available initially. auto messageId = msg->messageID(true)->identifier(); -- cgit v1.2.3