summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-26 06:36:45 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-26 06:36:45 (GMT)
commitfd9e51a0b67f10f3946dc83b57a7514fa4b2d2af (patch)
tree47a263ea59f342b2453b8f780ab3c40375cb2fe1
parentd5ccb8624ef337b8d26905860e00bbf01d0d0ea3 (diff)
Other optimization
-rw-r--r--messagecomposer/src/composer/composerviewbase.cpp3
-rw-r--r--messagecomposer/src/helper/messagefactory.cpp16
2 files changed, 12 insertions, 7 deletions
diff --git a/messagecomposer/src/composer/composerviewbase.cpp b/messagecomposer/src/composer/composerviewbase.cpp
index 76fa9bb..6210540 100644
--- a/messagecomposer/src/composer/composerviewbase.cpp
+++ b/messagecomposer/src/composer/composerviewbase.cpp
@@ -996,8 +996,7 @@ void MessageComposer::ComposerViewBase::fillQueueJobHeaders(MailTransport::Messa
}
// if this header is not empty, it contains the real recipient of the message, either the primary or one of the
// secondary recipients. so we set that to the transport job, while leaving the message itself alone.
- if (message->hasHeader("X-KMail-EncBccRecipients")) {
- KMime::Headers::Base *realTo = message->headerByType("X-KMail-EncBccRecipients");
+ if (KMime::Headers::Base *realTo = message->headerByType("X-KMail-EncBccRecipients")) {
qjob->addressAttribute().setTo(cleanEmailList(encodeIdn(realTo->asUnicodeString().split(QLatin1Char('%')))));
message->removeHeader("X-KMail-EncBccRecipients");
message->assemble();
diff --git a/messagecomposer/src/helper/messagefactory.cpp b/messagecomposer/src/helper/messagefactory.cpp
index 848c4b9..3b2eb9d 100644
--- a/messagecomposer/src/helper/messagefactory.cpp
+++ b/messagecomposer/src/helper/messagefactory.cpp
@@ -332,8 +332,8 @@ MessageFactory::MessageReply MessageFactory::createReply()
msg->setHeader(header);
}
- if (m_origMsg->hasHeader("X-KMail-EncryptActionEnabled")) {
- if (m_origMsg->headerByType("X-KMail-EncryptActionEnabled")->as7BitString(false).contains("true")) {
+ if (auto hrd = m_origMsg->headerByType("X-KMail-EncryptActionEnabled")) {
+ if (hrd->as7BitString(false).contains("true")) {
auto header = new KMime::Headers::Generic("X-KMail-EncryptActionEnabled");
header->fromUnicodeString(QStringLiteral("true"), "utf-8");
msg->setHeader(header);
@@ -693,9 +693,13 @@ KMime::Message::Ptr MessageFactory::createMDN(KMime::MDN::ActionMode a,
secondMsgPart->contentType()->setMimeType("message/disposition-notification");
secondMsgPart->contentTransferEncoding()->setEncoding(KMime::Headers::CE7Bit);
+ QByteArray originalRecipient = "";
+ if (auto hrd = m_origMsg->headerByType("Original-Recipient")) {
+ originalRecipient = hrd->as7BitString(false);
+ }
secondMsgPart->setBody(KMime::MDN::dispositionNotificationBodyContent(
finalRecipient,
- m_origMsg->headerByType("Original-Recipient") ? m_origMsg->headerByType("Original-Recipient")->as7BitString(false) : "",
+ originalRecipient,
m_origMsg->messageID()->as7BitString(false), /* Message-ID */
d, a, s, m, special));
receipt->addContent(secondMsgPart);
@@ -757,8 +761,10 @@ QPair< KMime::Message::Ptr, KMime::Content * > MessageFactory::createForwardDige
int id = 0;
foreach (const Akonadi::Item &item, items) {
KMime::Message::Ptr fMsg = MessageCore::Util::message(item);
- if (id == 0 && fMsg->hasHeader("X-KMail-Identity")) {
- id = fMsg->headerByType("X-KMail-Identity")->asUnicodeString().toInt();
+ if (id == 0) {
+ if (auto hrd = fMsg->headerByType("X-KMail-Identity")) {
+ id = hrd->asUnicodeString().toInt();
+ }
}
MessageCore::StringUtil::removePrivateHeaderFields(fMsg);