File indexing completed on 2024-06-23 05:18:39

0001 /*
0002   SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
0003   SPDX-FileCopyrightText: 2009 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.net
0004   SPDX-FileCopyrightText: 2009 Leo Franchi <lfranchi@kde.org>
0005 
0006   SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <KMime/Message>
0012 #include <Libkleo/Enum>
0013 
0014 namespace KMime
0015 {
0016 class Content;
0017 }
0018 
0019 namespace Akonadi
0020 {
0021 class MessageQueueJob;
0022 }
0023 
0024 namespace MessageComposer
0025 {
0026 namespace Util
0027 {
0028 /**
0029  * Sets the proper structural information such as content-type, cte, and charset on the encoded body content. Depending on the crypto options,
0030  *  original content may be needed to determine some of the values
0031  */
0032 KMime::Content *
0033 composeHeadersAndBody(KMime::Content *orig, QByteArray encodedBody, Kleo::CryptoMessageFormat format, bool sign, const QByteArray &hashAlgo = "pgp-sha1");
0034 
0035 /**
0036  * Sets the content-type for the top level of the mime content, based on the crypto format and if a signature is used.
0037  */
0038 void makeToplevelContentType(KMime::Content *content, Kleo::CryptoMessageFormat format, bool sign, const QByteArray &hashAlgo = "pgp-sha1");
0039 
0040 /**
0041  * Sets the nested content type of the content, for crypto operations.
0042  */
0043 void setNestedContentType(KMime::Content *content, Kleo::CryptoMessageFormat format, bool sign);
0044 
0045 /**
0046  * Sets the nested content dispositions for the crypto operations.
0047  */
0048 void setNestedContentDisposition(KMime::Content *content, Kleo::CryptoMessageFormat format, bool sign);
0049 
0050 /**
0051  * Helper that returns whether or not the current combination of crypto format and signing choice means that the
0052  * resulting message will be a mime message or not.
0053  */
0054 bool makeMultiMime(Kleo::CryptoMessageFormat f, bool sign);
0055 void addSendReplyForwardAction(const KMime::Message::Ptr &message, Akonadi::MessageQueueJob *qjob);
0056 }
0057 }