[PATCH 4/6] Add check for IDLE in capabilities

Ethan Glasser-Camp ethan at betacantrips.com
Wed May 18 13:48:55 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 |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py
index ceea3dc..5f697b7 100644
--- a/offlineimap/imapserver.py
+++ b/offlineimap/imapserver.py
@@ -412,7 +412,10 @@ 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:
+                imapobj.noop()
             self.event.wait()
             if self.event.isSet():
                 imapobj.noop()
-- 
1.7.4.1





More information about the OfflineIMAP-project mailing list