File indexing completed on 2025-03-09 04:47:42
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Christian Mollekopf <mollekopf@kolabsys.com> 0003 * 0004 * SPDX-License-Identifier: AGPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kolab_export.h" 0010 0011 #include <kolabformat.h> 0012 0013 #include "kolabdefinitions.h" 0014 0015 namespace Kolab 0016 { 0017 class KOLAB_EXPORT XMLObject 0018 { 0019 public: 0020 XMLObject(); 0021 0022 std::string getSerializedUID() const; 0023 0024 /// List of attachment names to be retrieved from the mime message (only when reading v2, for v3 attachments containing the cid: of the attachment-part are 0025 /// created ) 0026 std::vector<std::string> getAttachments() const; 0027 0028 Kolab::Event readEvent(const std::string &s, Kolab::Version version); 0029 std::string writeEvent(const Kolab::Event &, Kolab::Version version, const std::string &productId = std::string()); 0030 0031 Kolab::Todo readTodo(const std::string &s, Kolab::Version version); 0032 std::string writeTodo(const Kolab::Todo &, Kolab::Version version, const std::string &productId = std::string()); 0033 0034 Kolab::Journal readJournal(const std::string &s, Kolab::Version version); 0035 std::string writeJournal(const Kolab::Journal &, Kolab::Version version, const std::string &productId = std::string()); 0036 0037 Kolab::Freebusy readFreebusy(const std::string &s, Kolab::Version version); 0038 std::string writeFreebusy(const Kolab::Freebusy &, Kolab::Version version, const std::string &productId = std::string()); 0039 0040 std::string pictureAttachmentName() const; 0041 std::string logoAttachmentName() const; 0042 std::string soundAttachmentName() const; 0043 /** 0044 * Find the attachments and set them on the read Contact object. 0045 * 0046 * V2 Notes: 0047 * Picture, logo and sound must be retrieved from Mime Message attachments using they're corresponding attachment name. 0048 */ 0049 Kolab::Contact readContact(const std::string &s, Kolab::Version version); 0050 0051 /** 0052 * V2 Notes: 0053 * * Uses the following attachment names: 0054 * ** kolab-picture.png 0055 * ** kolab-logo.png 0056 * ** sound 0057 */ 0058 std::string writeContact(const Kolab::Contact &, Kolab::Version version, const std::string &productId = std::string()); 0059 0060 Kolab::DistList readDistlist(const std::string &s, Kolab::Version version); 0061 std::string writeDistlist(const Kolab::DistList &, Kolab::Version version, const std::string &productId = std::string()); 0062 0063 /** 0064 * V2 notes: 0065 * * set the creation date from the mime date header. 0066 */ 0067 Kolab::Note readNote(const std::string &s, Kolab::Version version); 0068 std::string writeNote(const Kolab::Note &, Kolab::Version version, const std::string &productId = std::string()); 0069 0070 Kolab::Configuration readConfiguration(const std::string &s, Kolab::Version version); 0071 std::string writeConfiguration(const Kolab::Configuration &, Kolab::Version version, const std::string &productId = std::string()); 0072 0073 Kolab::File readFile(const std::string &s, Kolab::Version version); 0074 std::string writeFile(const Kolab::File &, Kolab::Version version, const std::string &productId = std::string()); 0075 0076 private: 0077 std::vector<std::string> mAttachments; 0078 std::string mLogoAttachmentName; 0079 std::string mSoundAttachmentName; 0080 std::string mPictureAttachmentName; 0081 std::string mWrittenUID; 0082 }; 0083 }