[PATCH 09/13] Add check for IDLE in capabilities

Ethan Glasser-Camp ethan at betacantrips.com
Tue Mar 8 15:05:22 GMT 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 b501a0d..6caf387 100644
--- a/offlineimap/imapserver.py
+++ b/offlineimap/imapserver.py
@@ -445,7 +445,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.1





More information about the OfflineIMAP-project mailing list