KIMAP

enablejob.cpp
1/*
2 SPDX-FileCopyrightText: 2020 Daniel Vrátil <dvratil@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "enablejob.h"
8
9#include <KLocalizedString>
10
11#include "job_p.h"
12#include "kimap_debug.h"
13#include "response_p.h"
14#include "session_p.h"
15
16namespace KIMAP
17{
18class EnableJobPrivate : public JobPrivate
19{
20public:
21 using JobPrivate::JobPrivate;
22
23 QStringList reqCapabilities;
24 QStringList enabledCapabilities;
25};
26}
27
28using namespace KIMAP;
29
30EnableJob::EnableJob(Session *session)
31 : Job(*new EnableJobPrivate(session, i18n("Enable")))
32{
33}
34
35EnableJob::~EnableJob() = default;
36
37void EnableJob::setCapabilities(const QStringList &capabilities)
38{
40 d->reqCapabilities = capabilities;
41}
42
44{
45 Q_D(const EnableJob);
46 return d->enabledCapabilities;
47}
48
49void EnableJob::doStart()
50{
52 d->tags << d->sessionInternal()->sendCommand("ENABLE", d->reqCapabilities.join(QLatin1Char{' '}).toLatin1());
53}
54
55void EnableJob::handleResponse(const Response &response)
56{
58
59 if (handleErrorReplies(response) == NotHandled) {
60 if (response.content.size() >= 2) {
61 for (int i = 2; i < response.content.size(); ++i) {
62 d->enabledCapabilities.push_back(QString::fromLatin1(response.content[i].toString()));
63 }
64 } else {
65 qCDebug(KIMAP_LOG) << response.toString();
66 }
67 }
68}
69
70#include "moc_enablejob.cpp"
Job to enable additional IMAP capabilities.
Definition enablejob.h:34
void setCapabilities(const QStringList &capabilities)
List of server capabilities to enable.
Definition enablejob.cpp:37
QStringList enabledCapabilities() const
List of capabilities that were successfully enabled on the server.
Definition enablejob.cpp:43
Capabilities capabilities() const
QString i18n(const char *text, const TYPE &arg...)
QString fromLatin1(QByteArrayView str)
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:17 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.