File indexing completed on 2025-01-05 04:54:57
0001 /* 0002 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com> 0003 0004 This library is free software; you can redistribute it and/or modify it 0005 under the terms of the GNU Library General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or (at your 0007 option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, but WITHOUT 0010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 0012 License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to the 0016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0017 02110-1301, USA. 0018 */ 0019 0020 #pragma once 0021 0022 #include <QByteArray> 0023 #include <QStringList> 0024 #include <KMime/Message> 0025 #include <functional> 0026 #include <mailcrypto.h> 0027 0028 struct Attachment { 0029 QString name; 0030 QString filename; 0031 QByteArray mimeType; 0032 bool isInline; 0033 QByteArray data; 0034 }; 0035 0036 struct Recipients { 0037 QStringList to; 0038 QStringList cc; 0039 QStringList bcc; 0040 }; 0041 0042 namespace MailTemplates 0043 { 0044 void reply(const KMime::Message::Ptr &origMsg, const std::function<void(const KMime::Message::Ptr &result)> &callback, const KMime::Types::AddrSpecList &me = {}); 0045 void forward(const KMime::Message::Ptr &origMsg, const std::function<void(const KMime::Message::Ptr &result)> &callback); 0046 QString plaintextContent(const KMime::Message::Ptr &origMsg); 0047 QString body(const KMime::Message::Ptr &msg, bool &isHtml); 0048 KMime::Message::Ptr createMessage(KMime::Message::Ptr existingMessage, const QStringList &to, const QStringList &cc, const QStringList &bcc, const KMime::Types::Mailbox &from, const QString &subject, const QString &body, bool htmlBody, const QList<Attachment> &attachments, const std::vector<Crypto::Key> &signingKeys = {}, const std::vector<Crypto::Key> &encryptionKeys = {}, const Crypto::Key &attachedKey = {}); 0049 0050 KMime::Message::Ptr createIMipMessage( 0051 const QString &from, 0052 const Recipients &recipients, 0053 const QString &subject, 0054 const QString &body, 0055 const QString &attachment); 0056 };