KIMAP

capabilitiesjob.cpp
1/*
2 SPDX-FileCopyrightText: 2009 Kevin Ottens <ervin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "capabilitiesjob.h"
8
9#include <KLocalizedString>
10
11#include "job_p.h"
12#include "response_p.h"
13#include "session_p.h"
14
15namespace KIMAP
16{
17class CapabilitiesJobPrivate : public JobPrivate
18{
19public:
20 CapabilitiesJobPrivate(Session *session, const QString &name)
21 : JobPrivate(session, name)
22 {
23 }
24 ~CapabilitiesJobPrivate()
25 {
26 }
27
28 QStringList capabilities;
29};
30}
31
32using namespace KIMAP;
33
34CapabilitiesJob::CapabilitiesJob(Session *session)
35 : Job(*new CapabilitiesJobPrivate(session, i18n("Capabilities")))
36{
37}
38
39CapabilitiesJob::~CapabilitiesJob()
40{
41}
42
44{
45 Q_D(const CapabilitiesJob);
46 return d->capabilities;
47}
48
49void CapabilitiesJob::doStart()
50{
52 d->tags << d->sessionInternal()->sendCommand("CAPABILITY");
53}
54
55void CapabilitiesJob::handleResponse(const Response &response)
56{
58 if (handleErrorReplies(response) == NotHandled) {
59 const int responseSize(response.content.size());
60 if (responseSize >= 2 && response.content[1].toString() == "CAPABILITY") {
61 for (int i = 2; i < responseSize; ++i) {
62 d->capabilities << QLatin1StringView(response.content[i].toString().toUpper());
63 }
64 Q_EMIT capabilitiesReceived(d->capabilities);
65 }
66 }
67}
68
69#include "moc_capabilitiesjob.cpp"
Checks server capabilities.
QStringList capabilities() const
The capabilities the server claims to support.
void capabilitiesReceived(const QStringList &capabilities)
Notifies listeners that the capabilities have been fetched.
QString i18n(const char *text, const TYPE &arg...)
QString name(StandardAction id)
Q_EMITQ_EMIT
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:50:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.