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

0001 /*
0002     SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "unsubscribejob.h"
0008 
0009 #include <KLocalizedString>
0010 
0011 #include "job_p.h"
0012 #include "response_p.h"
0013 #include "rfccodecs.h"
0014 #include "session_p.h"
0015 
0016 namespace KIMAP
0017 {
0018 class UnsubscribeJobPrivate : public JobPrivate
0019 {
0020 public:
0021     UnsubscribeJobPrivate(Session *session, const QString &name)
0022         : JobPrivate(session, name)
0023     {
0024     }
0025     ~UnsubscribeJobPrivate()
0026     {
0027     }
0028 
0029     QString mailBox;
0030 };
0031 }
0032 
0033 using namespace KIMAP;
0034 
0035 UnsubscribeJob::UnsubscribeJob(Session *session)
0036     : Job(*new UnsubscribeJobPrivate(session, i18n("Unsubscribe")))
0037 {
0038 }
0039 
0040 UnsubscribeJob::~UnsubscribeJob()
0041 {
0042 }
0043 
0044 void UnsubscribeJob::doStart()
0045 {
0046     Q_D(UnsubscribeJob);
0047     d->tags << d->sessionInternal()->sendCommand("UNSUBSCRIBE", '\"' + KIMAP::encodeImapFolderName(d->mailBox.toUtf8()) + '\"');
0048 }
0049 
0050 void UnsubscribeJob::setMailBox(const QString &mailBox)
0051 {
0052     Q_D(UnsubscribeJob);
0053     d->mailBox = mailBox;
0054 }
0055 
0056 QString UnsubscribeJob::mailBox() const
0057 {
0058     Q_D(const UnsubscribeJob);
0059     return d->mailBox;
0060 }
0061 
0062 #include "moc_unsubscribejob.cpp"