diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index 2cea8ddaa..f9fad26f1 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -454,11 +454,39 @@ public class ImapStore extends Store this.mName = name; } - public String getPrefixedName() + public String getPrefixedName() throws MessagingException { String prefixedName = ""; if (!K9.INBOX.equalsIgnoreCase(mName)) { + ImapConnection connection = null; + synchronized (this) + { + if (mConnection == null) + { + connection = getConnection(); + } + else + { + connection = mConnection; + } + } + try + { + + connection.open(); + } + catch (IOException ioe) + { + throw new MessagingException("Unable to get IMAP prefix", ioe); + } + finally + { + if (mConnection == null) + { + releaseConnection(connection); + } + } prefixedName = getCombinedPrefix(); } @@ -1764,7 +1792,7 @@ public class ImapStore extends Store { if (o instanceof ImapFolder) { - return ((ImapFolder)o).getPrefixedName().equals(getPrefixedName()); + return ((ImapFolder)o).getName().equalsIgnoreCase(getName()); } return super.equals(o); }