KIMAP

capabilitiesjob.cpp
1 /*
2  SPDX-FileCopyrightText: 2009 Kevin Ottens <[email protected]>
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 
15 namespace KIMAP
16 {
17 class CapabilitiesJobPrivate : public JobPrivate
18 {
19 public:
20  CapabilitiesJobPrivate(Session *session, const QString &name) : JobPrivate(session, name) { }
21  ~CapabilitiesJobPrivate() { }
22 
24 };
25 }
26 
27 using namespace KIMAP;
28 
29 CapabilitiesJob::CapabilitiesJob(Session *session)
30  : Job(*new CapabilitiesJobPrivate(session, i18n("Capabilities")))
31 {
32 }
33 
34 CapabilitiesJob::~CapabilitiesJob()
35 {
36 }
37 
39 {
40  Q_D(const CapabilitiesJob);
41  return d->capabilities;
42 }
43 
44 void CapabilitiesJob::doStart()
45 {
46  Q_D(CapabilitiesJob);
47  d->tags << d->sessionInternal()->sendCommand("CAPABILITY");
48 }
49 
50 void CapabilitiesJob::handleResponse(const Response &response)
51 {
52  Q_D(CapabilitiesJob);
53  if (handleErrorReplies(response) == NotHandled) {
54  const int responseSize(response.content.size());
55  if (responseSize >= 2 &&
56  response.content[1].toString() == "CAPABILITY") {
57  for (int i = 2; i < responseSize; ++i) {
58  d->capabilities << QLatin1String(response.content[i].toString().toUpper());
59  }
60  Q_EMIT capabilitiesReceived(d->capabilities);
61  }
62  }
63 }
QStringList capabilities() const
The capabilities the server claims to support.
QString i18n(const char *text, const TYPE &arg...)
KDEGAMES_EXPORT Capabilities capabilities()
Checks server capabilities.
Definition: acl.cpp:12
Q_EMITQ_EMIT
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Oct 24 2020 23:16:51 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.