From 44da2e1fe608807850fa353466277739258e62c0 Mon Sep 17 00:00:00 2001 From: Daniel Applebaum Date: Thu, 20 May 2010 02:33:44 +0000 Subject: [PATCH] After discussion with cketti, reinstate using LIST to find the path delimeter, but only if the server does not support NAMESPACE. Since we've encountered non-compliant servers that freak out at the LIST command, enclose in a try/catch structure so that failures do not totally prevent IMAP communication. --- src/com/fsck/k9/mail/store/ImapStore.java | 27 +++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index 2f9a64eb5..e26a93458 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -90,7 +90,7 @@ public class ImapStore extends Store private AuthType mAuthType; private volatile String mPathPrefix; private volatile String mCombinedPrefix = null; - private volatile String mPathDelimeter; + private volatile String mPathDelimeter = null; private LinkedList mConnections = new LinkedList(); @@ -2284,6 +2284,29 @@ public class ImapStore extends Store mPathPrefix = ""; } } + if (mPathDelimeter == null) + { + try + { + List nameResponses = + executeSimpleCommand(String.format("LIST \"\" \"\"")); + for (ImapResponse response : nameResponses) + { + if (response.get(0).equals("LIST")) + { + mPathDelimeter = response.getString(2); + if (K9.DEBUG) + Log.d(K9.LOG_TAG, "Got path delimeter '" + mPathDelimeter + "' for " + getLogId()); + } + } + } + catch (Exception e) + { + Log.e(K9.LOG_TAG, "Unable to get path delimeter using LIST", e); + } + } + + } catch (SSLException e) { @@ -2986,7 +3009,7 @@ public class ImapStore extends Store } } if (K9.DEBUG) - Log.d(K9.LOG_TAG, "There are " + flagSyncMsgSeqs + " messages needing flag sync for " + getLogId()); + Log.d(K9.LOG_TAG, "UIDs for messages needing flag sync are " + flagSyncMsgSeqs + " for " + getLogId()); if (flagSyncMsgSeqs.size() > 0) {