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