File indexing completed on 2024-06-23 05:07:03
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2014 Daniel Vrátil <dvratil@redhat.com> * 0003 * * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later * 0005 ***************************************************************************/ 0006 0007 #include "tagfetchhandler.h" 0008 #include "connection.h" 0009 #include "tagfetchhelper.h" 0010 0011 using namespace Akonadi; 0012 using namespace Akonadi::Server; 0013 0014 TagFetchHandler::TagFetchHandler(AkonadiServer &akonadi) 0015 : Handler(akonadi) 0016 { 0017 } 0018 0019 bool TagFetchHandler::parseStream() 0020 { 0021 const auto &cmd = Protocol::cmdCast<Protocol::FetchTagsCommand>(m_command); 0022 0023 if (!checkScopeConstraints(cmd.scope(), Scope::Uid)) { 0024 return failureResponse("Only UID-based TAGFETCH is supported"); 0025 } 0026 0027 TagFetchHelper helper(connection(), cmd.scope(), cmd.fetchScope()); 0028 if (!helper.fetchTags()) { 0029 return failureResponse("Failed to fetch tags"); 0030 } 0031 0032 return successResponse<Protocol::FetchTagsResponse>(); 0033 }