File indexing completed on 2024-05-12 05:17:21
0001 /* 0002 Copyright (c) 2009 Andras Mantia <amantia@kde.org> 0003 0004 This library is free software; you can redistribute it and/or modify it 0005 under the terms of the GNU Library General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or (at your 0007 option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, but WITHOUT 0010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 0012 License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to the 0016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0017 02110-1301, USA. 0018 */ 0019 0020 #include "expungejob.h" 0021 0022 #include "kimap_debug.h" 0023 0024 #include "job_p.h" 0025 #include "message_p.h" 0026 #include "session_p.h" 0027 0028 namespace KIMAP2 0029 { 0030 class ExpungeJobPrivate : public JobPrivate 0031 { 0032 public: 0033 ExpungeJobPrivate(Session *session, const QString &name) : JobPrivate(session, name) { } 0034 ~ExpungeJobPrivate() { } 0035 #if 0 0036 QList< int > items; 0037 #endif 0038 }; 0039 } 0040 0041 using namespace KIMAP2; 0042 0043 ExpungeJob::ExpungeJob(Session *session) 0044 : Job(*new ExpungeJobPrivate(session, "Expunge")) 0045 { 0046 } 0047 0048 ExpungeJob::~ExpungeJob() 0049 { 0050 } 0051 0052 void ExpungeJob::doStart() 0053 { 0054 Q_D(ExpungeJob); 0055 d->sendCommand("EXPUNGE", {}); 0056 } 0057 0058 void ExpungeJob::handleResponse(const Message &response) 0059 { 0060 // Q_D(ExpungeJob); 0061 0062 if (handleErrorReplies(response) == NotHandled) { 0063 if (response.content.size() >= 3) { 0064 QByteArray code = response.content[2].toString(); 0065 if (code == "EXPUNGE") { 0066 #if 0 0067 QByteArray s = response.content[1].toString(); 0068 bool ok = true; 0069 int id = s.toInt(&ok); 0070 if (ok) { 0071 d->items.append(id); 0072 } 0073 //TODO error handling 0074 #endif 0075 return; 0076 } 0077 } 0078 qCDebug(KIMAP2_LOG) << "Unhandled response: " << response.toString().constData(); 0079 0080 } 0081 }