From 7bdd4a69fa5621c2fcf3213b32d2c21f1ba2b741 Mon Sep 17 00:00:00 2001 From: John Goerzen Date: Tue, 7 Jul 2009 00:04:52 -0500 Subject: [PATCH] Fix the order of folders during sync was broken by e1fb9492f84538df698d6a2f1cfa2738929ed040 (Patch for signal handling to start a sync by Jim Prior) This patch from Nicolas Dandrimont. Closes: #535540. --- offlineimap/accounts.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py index 93f5f15..55fba9b 100644 --- a/offlineimap/accounts.py +++ b/offlineimap/accounts.py @@ -37,9 +37,9 @@ class SigListener(Queue): # folders haven't yet been added, or this account is once-only; drop signal return elif self.folders: - for folder in self.folders: + for foldernr in range(len(self.folders)): # requeue folder - self.folders[folder] = True + self.folders[foldernr][1] = True self.quick = False return # else folders have already been cleared, put signal... @@ -49,22 +49,22 @@ class SigListener(Queue): def addfolders(self, remotefolders, autorefreshes, quick): self.folderlock.acquire() try: - self.folders = {} + self.folders = [] self.quick = quick self.autorefreshes = autorefreshes for folder in remotefolders: # new folders are queued - self.folders[folder] = True + self.folders.append([folder, True]) finally: self.folderlock.release() def clearfolders(self): self.folderlock.acquire() try: - for folder in self.folders: - if self.folders[folder]: + for folder, queued in self.folders: + if queued: # some folders still in queue return False - self.folders.clear() + self.folders[:] = [] return True finally: self.folderlock.release() @@ -74,10 +74,10 @@ class SigListener(Queue): dirty = True while dirty: dirty = False - for folder in self.folders: - if self.folders[folder]: + for foldernr, (folder, queued) in enumerate(self.folders): + if queued: # mark folder as no longer queued - self.folders[folder] = False + self.folders[foldernr][1] = False dirty = True quick = self.quick self.folderlock.release()