Akonadi

itemfetchhandler.cpp
1/***************************************************************************
2 * SPDX-FileCopyrightText: 2006 Tobias Koenig <tokoe@kde.org> *
3 * *
4 * SPDX-License-Identifier: LGPL-2.0-or-later *
5 ***************************************************************************/
6
7#include "itemfetchhandler.h"
8
9#include "cachecleaner.h"
10#include "connection.h"
11#include "itemfetchhelper.h"
12
13using namespace Akonadi;
14using namespace Akonadi::Server;
15
16ItemFetchHandler::ItemFetchHandler(AkonadiServer &akonadi)
17 : Handler(akonadi)
18{
19}
20
22{
23 const auto &cmd = Protocol::cmdCast<Protocol::FetchItemsCommand>(m_command);
24
25 CommandContext context = connection()->context();
26 if (!context.setScopeContext(cmd.scopeContext())) {
27 return failureResponse(QStringLiteral("Invalid scope context"));
28 }
29
30 // We require context in case we do RID fetch
31 if (context.isEmpty() && cmd.scope().scope() == Scope::Rid) {
32 return failureResponse(QStringLiteral("No FETCH context specified"));
33 }
34
35 CacheCleanerInhibitor inhibitor(akonadi());
36
37 ItemFetchHelper fetchHelper(connection(), context, cmd.scope(), cmd.itemFetchScope(), cmd.tagFetchScope(), akonadi(), cmd.itemsLimit());
38 if (!fetchHelper.fetchItems()) {
39 return failureResponse(QStringLiteral("Failed to fetch items"));
40 }
41
42 return successResponse<Protocol::FetchItemsResponse>();
43}
A RAII helper class to temporarily stop the CacheCleaner.
The handler interfaces describes an entity capable of handling an AkonadiIMAP command.
Definition handler.h:32
bool parseStream() override
Parse and handle the IMAP message using the streaming parser.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.