[PATCH 4/8] [imaplib2 readd] Revert "[imaplib2 removal] Revert "Added check for IDLE in capabilities""

Ethan Glasser-Camp ethan at betacantrips.com
Tue Dec 28 11:46:21 GMT 2010


This reverts commit 8e1fc718792fdff7aff62d4abac5ca5db8f270b9.
---
 offlineimap/imapserver.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py
index c6eded9..781ec12 100644
--- a/offlineimap/imapserver.py
+++ b/offlineimap/imapserver.py
@@ -422,8 +422,8 @@ class IdleThread(object):
 
     def noop(self):
         imapobj = self.parent.acquireconnection()
-        self.event.wait()
         imapobj.noop()
+        self.event.wait()
         self.parent.releaseconnection(imapobj)
 
     def dosync(self):
@@ -450,7 +450,10 @@ class IdleThread(object):
                     self.needsync = True
                     self.event.set()
             imapobj = self.parent.acquireconnection()
-            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