22#include "kimap_debug.h"
31class SelectJobPrivate :
public JobPrivate
35 : JobPrivate(session,
name), readOnly(false), messageCount(-1), recentCount(-1),
36 firstUnseenIndex(-1), uidValidity(-1), nextUid(-1), highestmodseq(0),
37 condstoreEnabled(false) { }
38 ~SelectJobPrivate() { }
50 quint64 highestmodseq;
51 bool condstoreEnabled;
55using namespace KIMAP2;
57SelectJob::SelectJob(
Session *session)
58 : Job(*new SelectJobPrivate(session,
"Select"))
62SelectJob::~SelectJob()
66void SelectJob::setMailBox(
const QString &mailBox)
72QString SelectJob::mailBox()
const
78void SelectJob::setOpenReadOnly(
bool readOnly)
81 d->readOnly = readOnly;
84bool SelectJob::isOpenReadOnly()
const
99 return d->permanentFlags;
102int SelectJob::messageCount()
const
104 Q_D(
const SelectJob);
105 return d->messageCount;
108int SelectJob::recentCount()
const
110 Q_D(
const SelectJob);
111 return d->recentCount;
114int SelectJob::firstUnseenIndex()
const
116 Q_D(
const SelectJob);
117 return d->firstUnseenIndex;
120qint64 SelectJob::uidValidity()
const
122 Q_D(
const SelectJob);
123 return d->uidValidity;
126qint64 SelectJob::nextUid()
const
128 Q_D(
const SelectJob);
132quint64 SelectJob::highestModSequence()
const
134 Q_D(
const SelectJob);
135 return d->highestmodseq;
138void SelectJob::setCondstoreEnabled(
bool enable)
141 d->condstoreEnabled = enable;
144bool SelectJob::condstoreEnabled()
const
146 Q_D(
const SelectJob);
147 return d->condstoreEnabled;
150void SelectJob::doStart()
161 if (d->condstoreEnabled) {
162 params +=
" (CONDSTORE)";
165 d->sendCommand(command, params);
168void SelectJob::handleResponse(
const Message &response)
172 if (handleErrorReplies(response) == NotHandled) {
173 if (response.content.size() >= 2) {
174 QByteArray code = response.content[1].toString();
177 if (response.responseCode.size() < 2) {
181 code = response.responseCode[0].toString();
183 if (code ==
"PERMANENTFLAGS") {
184 d->permanentFlags = response.responseCode[1].toList();
185 }
else if (code ==
"HIGHESTMODSEQ") {
187 quint64 value = response.responseCode[1].toString().toULongLong(&isInt);
191 d->highestmodseq = value;
194 qint64 value = response.responseCode[1].toString().toLongLong(&isInt);
198 if (code ==
"UIDVALIDITY") {
199 d->uidValidity = value;
200 }
else if (code ==
"UNSEEN") {
201 d->firstUnseenIndex = value;
202 }
else if (code ==
"UIDNEXT") {
206 }
else if (code ==
"FLAGS") {
207 d->flags = response.content[2].toList();
210 int value = response.content[1].toString().toInt(&isInt);
211 if (!isInt || response.content.size() < 3) {
215 code = response.content[2].toString();
216 if (code ==
"EXISTS") {
217 d->messageCount = value;
218 }
else if (code ==
"RECENT") {
219 d->recentCount = value;
223 qCDebug(KIMAP2_LOG) << response.toString();
226 Q_ASSERT(
error() || d->m_session->selectedMailBox() == d->mailBox);
QString name(GameStandardAction id)
This file is part of the IMAP support library and defines the RfcCodecs class.
KIMAP2_EXPORT QByteArray encodeImapFolderName(const QByteArray &src)
Converts an Unicode IMAP mailbox to a QByteArray which can be used in IMAP communication.