File indexing completed on 2024-05-12 05:17:14
0001 /* 0002 SPDX-FileCopyrightText: 2015 Christian Mollekopf <mollekopf@kolabsys.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "idjob.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 IdJobPrivate : public JobPrivate 0018 { 0019 public: 0020 IdJobPrivate(Session *session, const QString &name) 0021 : JobPrivate(session, name) 0022 { 0023 } 0024 ~IdJobPrivate() 0025 { 0026 } 0027 0028 QMap<QByteArray, QByteArray> fields; 0029 }; 0030 } 0031 0032 using namespace KIMAP; 0033 0034 IdJob::IdJob(Session *session) 0035 : Job(*new IdJobPrivate(session, i18n("Id"))) 0036 { 0037 } 0038 0039 IdJob::~IdJob() 0040 { 0041 } 0042 0043 void IdJob::setField(const QByteArray &name, const QByteArray &value) 0044 { 0045 Q_D(IdJob); 0046 d->fields.insert(name, value); 0047 } 0048 0049 void IdJob::doStart() 0050 { 0051 Q_D(IdJob); 0052 QByteArray command = "ID"; 0053 command += " ("; 0054 0055 QMapIterator<QByteArray, QByteArray> i(d->fields); 0056 while (i.hasNext()) { 0057 i.next(); 0058 command += "\"" + i.key() + "\" \"" + i.value() + "\" "; 0059 } 0060 command.chop(1); 0061 command += ")"; 0062 d->tags << d->sessionInternal()->sendCommand(command); 0063 } 0064 0065 void IdJob::handleResponse(const Response &response) 0066 { 0067 // Q_D(IdJob); 0068 if (handleErrorReplies(response) == NotHandled) { 0069 // Ignore the response 0070 } 0071 } 0072 0073 #include "moc_idjob.cpp"