Handle [ALREADYEXISTS] and Mailbox already exists!

Make compatible with IMAP servers that give the reason code "[ALREADYEXISTS]"
and IMAP servers that give natural language reason "Mailbox already exists!" by
searching for the two words "already" and "exists" in the exception reason
string.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Chris Coleman 2020-02-06 12:32:28 -05:00 committed by Nicolas Sebrecht
parent 564930725e
commit 84efb45270
1 changed files with 2 additions and 1 deletions

View File

@ -561,7 +561,8 @@ class IMAPRepository(BaseRepository):
try:
self.makefolder_single(folder_path)
except OfflineImapError as e:
if '[ALREADYEXISTS]' not in e.reason:
reasonLower = e.reason.lower() # Handle reasons '[ALREADYEXISTS]' and 'Mailbox already exists!' @chris001
if not ('already' in reasonLower and 'exists' in reasonLower):
raise
def makefolder_single(self, foldername):