From 6ad0de08ef66401426c03a58e6e5636f72ec7799 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Mon, 12 Sep 2011 10:37:55 +0200 Subject: [PATCH] IMAP IDLE cleanup(3): Rename self.event to self.stop_sig Variable name 'event' is as bad as it gets. Rename it to something that actually describes what it is about. Signed-off-by: Sebastian Spaeth Signed-off-by: Nicolas Sebrecht --- offlineimap/imapserver.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py index 20424f2..df2318c 100644 --- a/offlineimap/imapserver.py +++ b/offlineimap/imapserver.py @@ -461,7 +461,7 @@ class IdleThread(object): mode and synchronize once we have a new message""" self.parent = parent self.folder = folder - self.event = Event() + self.stop_sig = Event() self.ui = getglobalui() if folder is None: self.thread = Thread(target=self.noop) @@ -473,7 +473,7 @@ class IdleThread(object): self.thread.start() def stop(self): - self.event.set() + self.stop_sig.set() def join(self): self.thread.join() @@ -481,7 +481,7 @@ class IdleThread(object): def noop(self): imapobj = self.parent.acquireconnection() imapobj.noop() - self.event.wait() + self.stop_sig.wait() self.parent.releaseconnection(imapobj) def dosync(self): @@ -506,16 +506,16 @@ class IdleThread(object): minutes kicks in.""" result, cb_arg, exc_data = args if exc_data is None: - if not self.event.isSet(): + if not self.stop_sig.isSet(): self.needsync = True - self.event.set() + self.stop_sig.set() else: # We got an "abort" signal. self.imapaborted = True self.stop() while True: - if self.event.isSet(): + if self.stop_sig.isSet(): return self.needsync = False self.imapaborted = False @@ -540,8 +540,8 @@ class IdleThread(object): self.ui.warn("IMAP IDLE not supported on server '%s'." "Sleep until next refresh cycle." % imapobj.identifier) imapobj.noop() - self.event.wait() - if self.event.isSet(): + self.stop_sig.wait() # self.stop() or IDLE callback are invoked + if self.stop_sig.isSet(): # Can't NOOP on a bad connection. if not self.imapaborted: imapobj.noop() @@ -551,5 +551,5 @@ class IdleThread(object): if self.needsync: # here not via self.stop, but because IDLE responded. Do # another round and invoke actual syncing. - self.event.clear() + self.stop_sig.clear() self.dosync()