From 5342dacc6cc910c0e24e4fe608d9ff8ac7caca9d Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Fri, 12 Jul 2002 03:04:04 +0100 Subject: [PATCH] /head: changeset 109 Another go at dealing with weird STORE responses. --- head/offlineimap/folder/IMAP.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/head/offlineimap/folder/IMAP.py b/head/offlineimap/folder/IMAP.py index d397c4d..3dd2b91 100644 --- a/head/offlineimap/folder/IMAP.py +++ b/head/offlineimap/folder/IMAP.py @@ -151,9 +151,15 @@ class IMAPFolder(BaseFolder): needupdate = copy(uidlist) for result in r: if result == None: + # Compensate for servers that don't return anything from + # STORE. continue - flags = imaputil.flags2hash(imaputil.imapsplit(result)[1])['FLAGS'] - uid = long(imaputil.flags2hash(imaputil.imapsplit(result)[1])['UID']) + attributehash = imaputil.flags2hash(imaputil.imapsplit(result)[1]) + if not ('UID' in attributehash and 'FLAGS' in attributehash): + # Compensate for servers that don't return a UID attribute. + continue + flags = attributehash['FLAGS'] + uid = long(attributehash['UID']) self.messagelist[uid]['flags'] = imaputil.flagsimap2maildir(flags) try: needupdate.remove(uid)