From 36156fa98545792649771d2599ee06a74d35169c Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Wed, 6 Jun 2012 10:02:42 +0200 Subject: [PATCH] Remove the APPENDUID hack, previously introduced As Gmail was only announcing the presence of the UIDPLUS extension after we logged in, and we were then only getting server capabilities before, a hack was introduced that checked the existence of an APPENDUID reply, even if the server did not claim to support it. However, John Wiegley reports problems, where the APPENDUID would be None, and we attempt to go this path (it seems that imaplib2 returns [None] if there is no such reply, so our test here for "!=" might fail. Given that this is an undocumented imaplib2 function anyway, and we do fetch gmail capabilities after authentication, this hack should no longer be necessary. We had problems there earlier, where imapobj.response() would return [None] although we had received a APPENDUID response from the server, this might need more debugging and testing. Signed-off-by: Sebastian Spaeth --- Changelog.rst | 2 ++ offlineimap/folder/IMAP.py | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Changelog.rst b/Changelog.rst index e6f021a..30b58eb 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -9,6 +9,8 @@ WIP (add new stuff for the next release) ======================================== * Fix str.format() calls for Python 2.6 (D. Logie) +* Remove APPENDUID hack, previously introduced to fix Gmail, no longer + necessary, it might have been breaking things. (J. Wiegley) OfflineIMAP v6.5.4 (2012-06-02) ================================= diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index bb1b51f..75520c2 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -575,9 +575,8 @@ class IMAPFolder(BaseFolder): (typ,dat) = imapobj.check() assert(typ == 'OK') - # get the new UID. Test for APPENDUID response even if the - # server claims to not support it, as e.g. Gmail does :-( - if use_uidplus or imapobj._get_untagged_response('APPENDUID', True): + # get the new UID, do we use UIDPLUS? + if use_uidplus: # get new UID from the APPENDUID response, it could look # like OK [APPENDUID 38505 3955] APPEND completed with # 38505 bein folder UIDvalidity and 3955 the new UID. @@ -585,7 +584,7 @@ class IMAPFolder(BaseFolder): # often seems to return [None], even though we have # data. TODO resp = imapobj._get_untagged_response('APPENDUID') - if resp == [None]: + if resp == [None] or resp is None: self.ui.warn("Server supports UIDPLUS but got no APPENDUID " "appending a message.") return 0