update CAPABILITIES after login

Some Webservers (I am looking at you Gmail) send different capabilities
before and after login, so they can tailor their server capabilities to
the user. While legal, this is uncommon and we were not updating our
server capabilities. Doing so allows us to detect that Gmail actually
supports the UIDPLUS extension, and we will stop mangling headers when
uploading to Gmail. This could lead to some performance gains when we
upload many messages to Gmail.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2011-09-21 02:16:33 +02:00
parent db28cb77e7
commit 347e1eaa32
2 changed files with 10 additions and 2 deletions

View File

@ -16,5 +16,9 @@ New Features
Changes
-------
* Refresh server capabilities after login, so we know that Gmail
supports UIDPLUS (it only announces that after login, not
before). This prevents us from adding custom headers to Gmail uploads.
Bug Fixes
---------

View File

@ -1,6 +1,5 @@
# IMAP server support
# Copyright (C) 2002 - 2007 John Goerzen
# <jgoerzen@complete.org>
# Copyright (C) 2002 - 2011 John Goerzen & contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -276,6 +275,11 @@ class IMAPServer:
self.passworderror = str(val)
raise
# update capabilities after login, e.g. gmail serves different ones
typ, dat = imapobj.capability()
if dat != [None]:
imapobj.capabilities = tuple(dat[-1].upper().split())
if self.delim == None:
listres = imapobj.list(self.reference, '""')[1]
if listres == [None] or listres == None: