From 9782eba7c164eba5625bc4224ad0f49ec2fc76a7 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 23 May 2018 22:01:22 +0200 Subject: Removed unused code --- framework/src/domain/mime/mailtemplates.cpp | 62 ++++++----------------------- 1 file changed, 12 insertions(+), 50 deletions(-) diff --git a/framework/src/domain/mime/mailtemplates.cpp b/framework/src/domain/mime/mailtemplates.cpp index c7ae481e..2c9f6523 100644 --- a/framework/src/domain/mime/mailtemplates.cpp +++ b/framework/src/domain/mime/mailtemplates.cpp @@ -248,54 +248,6 @@ KMime::Content *createMultipartMixedContent(QVector contents) return multiPartMixed; } -void addProcessedBodyToMessage(const KMime::Message::Ptr &msg, const QString &plainBody, const QString &htmlBody, bool forward) -{ - //FIXME - // MessageCore::ImageCollector ic; - // ic.collectImagesFrom(mOrigMsg.data()); - - // Now, delete the old content and set the new content, which - // is either only the new text or the new text with some attachments. - auto parts = msg->contents(); - foreach (KMime::Content *content, parts) { - msg->removeContent(content, true/*delete*/); - } - - msg->contentType()->clear(); // to get rid of old boundary - - const QByteArray boundary = KMime::multiPartBoundary(); - KMime::Content *const mainTextPart = - htmlBody.isEmpty() ? - createPlainPartContent(plainBody, msg.data()) : - createMultipartAlternativeContent(plainBody, htmlBody, msg.data()); - mainTextPart->assemble(); - - KMime::Content *textPart = mainTextPart; - // if (!ic.images().empty()) { - // textPart = createMultipartRelated(ic, mainTextPart); - // textPart->assemble(); - // } - - // If we have some attachments, create a multipart/mixed mail and - // add the normal body as well as the attachments - KMime::Content *mainPart = textPart; - //FIXME - // if (forward) { - // auto attachments = mOrigMsg->attachments(); - // attachments += mOtp->nodeHelper()->attachmentsOfExtraContents(); - // if (!attachments.isEmpty()) { - // mainPart = createMultipartMixed(attachments, textPart); - // mainPart->assemble(); - // } - // } - - msg->setBody(mainPart->encodedBody()); - msg->setHeader(mainPart->contentType()); - msg->setHeader(mainPart->contentTransferEncoding()); - msg->assemble(); - msg->parse(); -} - QString plainToHtml(const QString &body) { QString str = body; @@ -879,11 +831,21 @@ void MailTemplates::reply(const KMime::Message::Ptr &origMsg, const std::functio }(); //Assemble the message - addProcessedBodyToMessage(msg, plainBodyResult, htmlBodyResult, false); + msg->contentType()->clear(); // to get rid of old boundary + + KMime::Content *const mainTextPart = + htmlBodyResult.isEmpty() ? + createPlainPartContent(plainBodyResult, msg.data()) : + createMultipartAlternativeContent(plainBodyResult, htmlBodyResult, msg.data()); + mainTextPart->assemble(); + + msg->setBody(mainTextPart->encodedBody()); + msg->setHeader(mainTextPart->contentType()); + msg->setHeader(mainTextPart->contentTransferEncoding()); //FIXME this does more harm than good right now. // applyCharset(msg, origMsg); msg->assemble(); - //We're done + callback(msg); }); }); -- cgit v1.2.3