Throw OfflineImapError when we try to request an inexistant message

During a sync run, someone might remove or move IMAP messages. As we
only cache the list of UIDs in the beginning, we might be requesting
UIDs that don't exist anymore. Protect folder.IMAP.getmessage() against
the response that we get when we ask for unknown UIDs.

Also, if the server responds with anything else than "OK", (eg. Gmail
seems to be saying frequently ['NO', 'Dave I can't let you do that now']
:-) so we should also be throwing OfflineImapErrors here rather than
AssertionErrors.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Sebastian Spaeth
2011-06-17 08:56:30 +02:00
committed by Nicolas Sebrecht
parent 41fad17125
commit 7570f71880
3 changed files with 19 additions and 5 deletions

View File

@ -301,7 +301,7 @@ class IMAPServer:
(self.hostname, self.reposname)
raise OfflineImapError(reason, severity)
elif isinstance(e, SSLError) and e.errno == 1:
elif SSLError and isinstance(e, SSLError) and e.errno == 1:
# SSL unknown protocol error
# happens e.g. when connecting via SSL to a non-SSL service
if self.port != 443: