Frustrated that KMail won’t use IMAP IDLE with Gmail? I found the blocker :-)

For some reason I really like having IMAP IDLE - emails drop in individually when received, rather than as a group when polled. Annoyed me an unreasonable amount that although IMAP IDLE was advertised and was present in the codebase, it simply wasn’t working and I couldn’t seem to get AkonadiConsole to show me anything useful. Added some debug statements in to kde-pim-runtime to check.

The short version: the IDLE code path is present and looked like it should work, but for my totally normal Gmail/OAUTH2 account it was blocked by a ‘mustFetchPassword’ check in ImapResourceBase::startIdle():

if (settings()->mustFetchPassword()) {
    return;
}

After removing that return (as a test - not a ‘proper’ fix) - ImapIdleManager was created for INBOX and KMail received new mail via the IMAP IdleJob without polling.

I’ve added details to the KDE bug here: https://bugs.kde.org/show_bug.cgi?id=520672

This isn’t a final fix, but if anyone else is comfortable rebuilding kdepim-runtime and has Gmail/Google Workspace accounts in KMail, then you too can experience IMAP IDLE! Also - maybe this is a pointer for devs for a potentially easy fix if you want to get KMail IMAP IDLE support working for everyone.

To close this one off, did some more investigation and found the correct fix, proposed it back to the project, it’s accepted and is now upstream. Tiny fix in a large codebase!

RussH