From 7256dc6e735bbd9a7ffa1183fcc577c4141ccb9b Mon Sep 17 00:00:00 2001 From: Patrick Ulbrich Date: Sun, 20 Dec 2015 20:08:12 +0100 Subject: [PATCH] Fix folder parsing. Fixes issue #108 --- Mailnag/common/accounts.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Mailnag/common/accounts.py b/Mailnag/common/accounts.py index 8a541a2..e7ac956 100644 --- a/Mailnag/common/accounts.py +++ b/Mailnag/common/accounts.py @@ -103,9 +103,19 @@ class Account: finally: # conn.close() # allowed in SELECTED state only conn.logout() + + separators = [ ' "/" ', ' "." ' ] + for d in data: + folder = '' + for s in separators: + if s in d: + folder = d.split(s)[-1] + break + + if len(folder) == 0: + logging.warning("Folder format not supported.") + break - for s in data: - folder = s.split(' "/" ')[-1] if (folder[0] == '"') and (folder[-1] == '"'): folder = folder[1:-1]