February 10, 2009

OfflineIMAP IDLE support

Filed under: Technical — Tags: , , — James Bunton @ 4:36 pm

I’ve implemented IDLE support into OfflineIMAP. For the last day or two I’ve been using this and I’m loving the instant email notifications. I emailed the original author and plan to work with him to get the code included into an official OfflineIMAP release.

There’s a Git repository with the patch included here:

I followed the plan John Goerzen suggested in offlineimap ticket 18. Here’s an overview of the changes.

  • Use imaplib2 as it implements the IDLE command and a few other nice things. This is written by Piers Lauder, the author Python’s standard imaplib.
  • Some small changes to the OfflineIMAP code were needed for it to work with imaplib2.
  • Added a config parameter ‘idlefolders’ to specify a list of mailboxes to monitor. This parameter forces holdconnectionopen, keepalive and maxconnections to be sane values.
  • Hijack the keepalive thread. Use the available connections for IDLE, one on each of the given mailboxes. If there are leftover connections we send NOOP as before.
  • Added documentation to the sample offlineimap.conf


Armim says:

Just updated to the new offlineimap supporting IMAP IDLE. I love it. Thanks for implementing it!

This is fantastic. Thanks!


Adrien Bustany says:

Any news on upstream integration ?

Greg Darke says:

@Adrien: It was actually dropped from upstream, due to the subtle API changes that were introduced with the new imap library that was used.

Martin Ling says:

Can you say any more about the problems that caused this to be dropped from upstream, i.e. was it just an issue for the development or were there user-visible problems?

I’d like to use this feature and would be happy to use your version instead of upstream, but I’d like to know if it’s been working reliably for people.

Leave a Reply

Your email address will not be published. Required fields are marked *