File indexing completed on 2024-11-24 04:44:17
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Christian Mollekopf <mollekopf@kolabsys.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kolab_export.h" 0010 0011 #include <KMime/Message> 0012 0013 namespace Kolab 0014 { 0015 class Attachment; 0016 namespace Mime 0017 { 0018 KMime::Content *findContentByName(const KMime::Message::Ptr &data, const QString &name, QByteArray &type); 0019 KMime::Content *findContentByType(const KMime::Message::Ptr &data, const QByteArray &type); 0020 QList<QByteArray> getContentMimeTypeList(const KMime::Message::Ptr &data); 0021 0022 /** 0023 * Get Attachments from a Mime message 0024 * 0025 * Set the attachments listed in @param attachments on @param incidence from @param mimeData 0026 */ 0027 Kolab::Attachment getAttachment(const std::string &id, const KMime::Message::Ptr &mimeData); 0028 Kolab::Attachment getAttachmentByName(const QString &name, const KMime::Message::Ptr &mimeData); 0029 0030 KMime::Message::Ptr createMessage(const QByteArray &mimetype, 0031 const QByteArray &xKolabType, 0032 const QByteArray &xml, 0033 bool v3, 0034 const QByteArray &productId, 0035 const QByteArray &fromEmail, 0036 const QString &fromName, 0037 const QString &subject); 0038 KMime::Message::Ptr createMessage(const std::string &mimetype, 0039 const std::string &xKolabType, 0040 const std::string &xml, 0041 bool v3, 0042 const std::string &productId, 0043 const std::string &fromEmail, 0044 const std::string &fromName, 0045 const std::string &subject); 0046 0047 /// Generic serializing functions 0048 KMime::Message::Ptr 0049 createMessage(const QString &subject, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid); 0050 KMime::Message::Ptr createMessage(const QByteArray &mimeType, bool v3, const QByteArray &prodid); 0051 0052 KMime::Content *createExplanationPart(); 0053 KMime::Content *createMainPart(const QByteArray &mimeType, const QByteArray &decodedContent); 0054 KMime::Content *createAttachmentPart(const QByteArray &cid, const QByteArray &mimeType, const QString &fileName, const QByteArray &decodedContent); 0055 QString fromCid(const QString &cid); 0056 } 0057 } // Namespace