Increase compatability with Gmail

When uploading a new message to Gmail we need to find out the UID it
assigned it, but Gmail does not advertize the UIDPLUS extension (in all
cases) and it fails to find the email that we just uploaded when
searching for it. This prevented us effectively from uploading to
gmail.

See analysis in
http://lists.alioth.debian.org/pipermail/offlineimap-project/2011-March/001449.html
for details on what is going wrong.

This patch increases compatability with Gmail by checking for APPENDUID
responses to an APPEND action even if the server did not claim to
support it. This restores the capability to upload messages to the
*broken* Gmail IMAP implementation.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2011-03-25 10:19:30 +01:00 committed by Nicolas Sebrecht
parent 105da1b0c3
commit 09515f8f90
2 changed files with 6 additions and 2 deletions

View File

@ -16,6 +16,9 @@ New Features
Changes
-------
* Increase compatability with Gmail servers which claim to not support
the UIDPLUS extension but in reality do.
Bug Fixes
---------

View File

@ -439,8 +439,9 @@ class IMAPFolder(BaseFolder):
(typ,dat) = imapobj.check()
assert(typ == 'OK')
# get the UID.
if use_uidplus:
# 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 from the APPENDUID response, it could look like
# OK [APPENDUID 38505 3955] APPEND completed
# with 38505 bein folder UIDvalidity and 3955 the new UID