Commit 427b560f authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

[IMAP] Fix missing connect() when restarting IDLE job

Restarted IDLE job did not listen for flags changes.
parent 61bee84d
......@@ -97,6 +97,11 @@ void ImapIdleManager::onSessionRequestDone(qint64 requestId, KIMAP::Session *ses
connect(m_pool, &SessionPool::connectionLost, this, &ImapIdleManager::onConnectionLost);
connect(m_pool, &SessionPool::disconnectDone, this, &ImapIdleManager::onPoolDisconnect);
startIdle();
}
void ImapIdleManager::startIdle()
{
KIMAP::SelectJob *select = new KIMAP::SelectJob(m_session);
select->setMailBox(m_state->mailBoxForCollection(m_state->collection()));
connect(select, &KIMAP::SelectJob::result, this, &ImapIdleManager::onSelectDone);
......@@ -142,10 +147,7 @@ void ImapIdleManager::onIdleStopped()
m_idle = nullptr;
if (m_session) {
qCDebug(IMAPRESOURCE_LOG) << "Restarting the IDLE session!";
m_idle = new KIMAP::IdleJob(m_session);
connect(m_idle.data(), &KIMAP::IdleJob::mailBoxStats, this, &ImapIdleManager::onStatsReceived);
connect(m_idle.data(), &KIMAP::IdleJob::result, this, &ImapIdleManager::onIdleStopped);
m_idle->start();
startIdle();
}
}
......
......@@ -69,6 +69,8 @@ private Q_SLOTS:
void reconnect();
private:
void startIdle();
qint64 m_sessionRequestId;
SessionPool *m_pool;
KIMAP::Session *m_session;
......
......@@ -632,6 +632,8 @@ void ImapResourceBase::onIdleCollectionFetchDone(KJob *job)
if (!fetch->collections().isEmpty()) {
delete m_idle;
m_idle = new ImapIdleManager(createResourceState(TaskArguments(fetch->collections().at(0))), m_pool, this);
} else {
qCWarning(IMAPRESOURCE_LOG) << "Failed to retrieve IDLE collection: no such collection";
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment