File indexing completed on 2024-06-23 05:07:01

0001 /***************************************************************************
0002  *   SPDX-FileCopyrightText: 2007 Robert Zwerus <arzie@dds.nl>             *
0003  *                                                                         *
0004  *   SPDX-License-Identifier: LGPL-2.0-or-later                            *
0005  ***************************************************************************/
0006 
0007 #pragma once
0008 
0009 #include "entities.h"
0010 #include "handler.h"
0011 
0012 namespace Akonadi
0013 {
0014 namespace Server
0015 {
0016 /**
0017   @ingroup akonadi_server_handler
0018 
0019   Handler for the X-AKAPPEND command.
0020 
0021   This command is used to append an item with multiple parts.
0022 
0023  */
0024 class ItemCreateHandler : public Handler
0025 {
0026 public:
0027     ItemCreateHandler(AkonadiServer &akonadi);
0028     ~ItemCreateHandler() override = default;
0029 
0030     bool parseStream() override;
0031 
0032 private:
0033     bool buildPimItem(const Protocol::CreateItemCommand &cmd, PimItem &item, Collection &parentCollection);
0034 
0035     bool insertItem(const Protocol::CreateItemCommand &cmd, PimItem &item, const Collection &parentCollection);
0036 
0037     bool mergeItem(const Protocol::CreateItemCommand &cmd, PimItem &newItem, PimItem &currentItem, const Collection &parentCollection);
0038 
0039     bool sendResponse(const PimItem &item, Protocol::CreateItemCommand::MergeModes mergeModes);
0040 
0041     bool notify(const PimItem &item, bool seen, const Collection &collection);
0042     bool notify(const PimItem &item, const Collection &collection, const QSet<QByteArray> &changedParts);
0043 
0044     void recoverFromMultipleMergeCandidates(const PimItem::List &items, const Collection &collection);
0045 };
0046 
0047 } // namespace Server
0048 } // namespace Akonadi