KIMAP2

expungejob.cpp
1 /*
2  Copyright (c) 2009 Andras Mantia <[email protected]>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #include "expungejob.h"
21 
22 #include "kimap_debug.h"
23 
24 #include "job_p.h"
25 #include "message_p.h"
26 #include "session_p.h"
27 
28 namespace KIMAP2
29 {
30 class ExpungeJobPrivate : public JobPrivate
31 {
32 public:
33  ExpungeJobPrivate(Session *session, const QString &name) : JobPrivate(session, name) { }
34  ~ExpungeJobPrivate() { }
35 #if 0
36  QList< int > items;
37 #endif
38 };
39 }
40 
41 using namespace KIMAP2;
42 
43 ExpungeJob::ExpungeJob(Session *session)
44  : Job(*new ExpungeJobPrivate(session, "Expunge"))
45 {
46 }
47 
48 ExpungeJob::~ExpungeJob()
49 {
50 }
51 
52 void ExpungeJob::doStart()
53 {
54  Q_D(ExpungeJob);
55  d->sendCommand("EXPUNGE", {});
56 }
57 
58 void ExpungeJob::handleResponse(const Message &response)
59 {
60 // Q_D(ExpungeJob);
61 
62  if (handleErrorReplies(response) == NotHandled) {
63  if (response.content.size() >= 3) {
64  QByteArray code = response.content[2].toString();
65  if (code == "EXPUNGE") {
66 #if 0
67  QByteArray s = response.content[1].toString();
68  bool ok = true;
69  int id = s.toInt(&ok);
70  if (ok) {
71  d->items.append(id);
72  }
73  //TODO error handling
74 #endif
75  return;
76  }
77  }
78  qCDebug(KIMAP2_LOG) << "Unhandled response: " << response.toString().constData();
79 
80  }
81 }
int toInt(bool *ok, int base) const const
Expunges the deleted messages in the selected mailbox.
Definition: expungejob.h:46
Definition: acl.cpp:25
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Dec 2 2021 23:01:35 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.