[PATCH 4/6] Add check for IDLE in capabilities
Ethan Glasser-Camp
ethan at betacantrips.com
Thu May 19 20:02:29 BST 2011
If the server doesn't support IDLE, we fall back to the standard
noop() keepalive.
This commit was originally by James Bunton <jamesbunton at fastmail.fm>.
Signed-off-by: Ethan Glasser-Camp <ethan at betacantrips.com>
---
offlineimap/imapserver.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py
index e5613fb..889daa3 100644
--- a/offlineimap/imapserver.py
+++ b/offlineimap/imapserver.py
@@ -411,7 +411,13 @@ class IdleThread(object):
self.event.set()
imapobj = self.parent.acquireconnection()
imapobj.select(self.folder)
- imapobj.idle(callback=callback)
+ if "IDLE" in imapobj.capabilities:
+ imapobj.idle(callback=callback)
+ else:
+ self.ui = getglobalui()
+ ui.warn("IMAP IDLE not supported on connection to %s; falling back to no-op"
+ %(imapobj.identifier,))
+ imapobj.noop()
self.event.wait()
if self.event.isSet():
imapobj.noop()
--
1.7.4.1
More information about the OfflineIMAP-project
mailing list