[PATCH] folder/IMAP: Remove buggy duplicate assignment

Sebastian Spaeth Sebastian at SSpaeth.de
Mon Jun 6 22:21:47 BST 2011


we do:
  for msgid in imapdata:
      maxmsgid = max(long(msgid), maxmsgid)
and then basically immediately:
   maxmsgid = long(imapdata[0])

throwing away the first assignment although the first method of
assigning is the correct one. The second had been forgotten to be
removed when we introduced the above iteration. This bug would fix a
regression with those broken ZIMBRA servers that send multiple EXISTS
replies.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
This is v2 fixing Nicolas comments (commit message), and based on
current master. I hope Nicolas gets to merge it when he is back from his
vacations.

 offlineimap/folder/IMAP.py |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py
index b8d91c7..2ed0c22 100644
--- a/offlineimap/folder/IMAP.py
+++ b/offlineimap/folder/IMAP.py
@@ -164,13 +164,11 @@ class IMAPFolder(BaseFolder):
                 maxmsgid = 0
                 for msgid in imapdata:
                     maxmsgid = max(long(msgid), maxmsgid)
-
-                maxmsgid = long(imapdata[0])
-                messagesToFetch = '1:%d' % maxmsgid;
-
                 if maxmsgid < 1:
                     #no messages; return
                     return
+                messagesToFetch = '1:%d' % maxmsgid;
+
             # Now, get the flags and UIDs for these.
             # We could conceivably get rid of maxmsgid and just say
             # '1:*' here.
-- 
1.7.4.1





More information about the OfflineIMAP-project mailing list