File indexing completed on 2024-05-12 05:17:12

0001 /*
0002     SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "closejob.h"
0008 
0009 #include <KLocalizedString>
0010 
0011 #include "job_p.h"
0012 #include "response_p.h"
0013 #include "session_p.h"
0014 
0015 namespace KIMAP
0016 {
0017 class CloseJobPrivate : public JobPrivate
0018 {
0019 public:
0020     CloseJobPrivate(Session *session, const QString &name)
0021         : JobPrivate(session, name)
0022     {
0023     }
0024 
0025     quint64 highestModSeq = 0;
0026 };
0027 }
0028 
0029 using namespace KIMAP;
0030 
0031 CloseJob::CloseJob(Session *session)
0032     : Job(*new CloseJobPrivate(session, i18n("Close")))
0033 {
0034 }
0035 
0036 void CloseJob::doStart()
0037 {
0038     Q_D(CloseJob);
0039     d->tags << d->sessionInternal()->sendCommand("CLOSE");
0040 }
0041 
0042 quint64 CloseJob::newHighestModSeq() const
0043 {
0044     Q_D(const CloseJob);
0045     return d->highestModSeq;
0046 }
0047 
0048 void CloseJob::handleResponse(const Response &response)
0049 {
0050     Q_D(CloseJob);
0051 
0052     if (response.responseCode.size() >= 2 && response.responseCode[0].toString() == "HIGHESTMODSEQ") {
0053         d->highestModSeq = response.responseCode[1].toString().toULongLong();
0054     }
0055 
0056     Job::handleErrorReplies(response);
0057 }
0058 
0059 #include "moc_closejob.cpp"