[PATCH 2/2] folder/IMAP: Remove buggy duplicate assignment

Sebastian Spaeth Sebastian at SSpaeth.de
Mon Apr 11 17:09:08 BST 2011


Right after performing
   for msgid in imapdata:
      maxmsgid = max(long(msgid), maxmsgid)
we were doing:
   maxmsgid = long(imapdata[0])

which is clearly bogus and a line that has 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 clearly a bugfix that should go in before the next release.
The real change is to remove the superfluous:
                maxmsgid = long(imapdata[0])

The other line is just moving an assignment a few lines down.


 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 f2d0dda..49362c8 100644
--- a/offlineimap/folder/IMAP.py
+++ b/offlineimap/folder/IMAP.py
@@ -178,13 +178,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.1





More information about the OfflineIMAP-project mailing list