1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Make sure prefix is fetched before any call to getCombinedPrefix.

This commit is contained in:
Daniel Applebaum 2010-05-22 17:34:16 +00:00
parent 493cdc4f5d
commit 24b178773f

View File

@ -462,11 +462,39 @@ public class ImapStore extends Store
this.mName = name; this.mName = name;
} }
public String getPrefixedName() public String getPrefixedName() throws MessagingException
{ {
String prefixedName = ""; String prefixedName = "";
if (!K9.INBOX.equalsIgnoreCase(mName)) 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(); prefixedName = getCombinedPrefix();
} }
@ -1954,7 +1982,7 @@ public class ImapStore extends Store
{ {
if (o instanceof ImapFolder) if (o instanceof ImapFolder)
{ {
return ((ImapFolder)o).getPrefixedName().equalsIgnoreCase(getPrefixedName()); return ((ImapFolder)o).getName().equalsIgnoreCase(getName());
} }
return super.equals(o); return super.equals(o);
} }
@ -1962,7 +1990,7 @@ public class ImapStore extends Store
@Override @Override
public int hashCode() public int hashCode()
{ {
return getPrefixedName().hashCode(); return getName().hashCode();
} }
protected ImapStore getStore() protected ImapStore getStore()