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 <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-06-06 10:02:42 +02:00
parent a614f9a735
commit 36156fa985
2 changed files with 5 additions and 4 deletions

View File

@ -9,6 +9,8 @@ WIP (add new stuff for the next release)
======================================== ========================================
* Fix str.format() calls for Python 2.6 (D. Logie) * 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) OfflineIMAP v6.5.4 (2012-06-02)
================================= =================================

View File

@ -575,9 +575,8 @@ class IMAPFolder(BaseFolder):
(typ,dat) = imapobj.check() (typ,dat) = imapobj.check()
assert(typ == 'OK') assert(typ == 'OK')
# get the new UID. Test for APPENDUID response even if the # get the new UID, do we use UIDPLUS?
# server claims to not support it, as e.g. Gmail does :-( if use_uidplus:
if use_uidplus or imapobj._get_untagged_response('APPENDUID', True):
# get new UID from the APPENDUID response, it could look # get new UID from the APPENDUID response, it could look
# like OK [APPENDUID 38505 3955] APPEND completed with # like OK [APPENDUID 38505 3955] APPEND completed with
# 38505 bein folder UIDvalidity and 3955 the new UID. # 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 # often seems to return [None], even though we have
# data. TODO # data. TODO
resp = imapobj._get_untagged_response('APPENDUID') 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 " self.ui.warn("Server supports UIDPLUS but got no APPENDUID "
"appending a message.") "appending a message.")
return 0 return 0