Loading src/com/fsck/k9/Preferences.java +4 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ import java.util.Map; import android.content.Context; import android.content.SharedPreferences; import android.util.Log; import com.fsck.k9.mail.Store; import com.fsck.k9.preferences.Editor; import com.fsck.k9.preferences.Storage; Loading Loading @@ -123,6 +125,8 @@ public class Preferences { accountsInOrder.remove(account); } Store.removeAccount(account); account.delete(this); if (newAccount == account) { Loading src/com/fsck/k9/mail/Store.java +44 −2 Original line number Diff line number Diff line Loading @@ -7,8 +7,10 @@ import java.util.concurrent.ConcurrentHashMap; import android.app.Application; import android.content.Context; import android.util.Log; import com.fsck.k9.Account; import com.fsck.k9.K9; import com.fsck.k9.mail.store.ImapStore; import com.fsck.k9.mail.store.LocalStore; import com.fsck.k9.mail.store.Pop3Store; Loading Loading @@ -111,6 +113,48 @@ public abstract class Store { } } public static void removeAccount(Account account) { try { removeRemoteInstance(account); } catch (Exception e) { Log.e(K9.LOG_TAG, "Failed to reset remote store for account " + account.getUuid(), e); } try { removeLocalInstance(account); } catch (Exception e) { Log.e(K9.LOG_TAG, "Failed to reset local store for account " + account.getUuid(), e); } } /** * Release reference to a local mail store instance. * * @param account * {@link Account} instance that is used to get the local mail store instance. */ private static void removeLocalInstance(Account account) { String accountUuid = account.getUuid(); sLocalStores.remove(accountUuid); } /** * Release reference to a remote mail store instance. * * @param account * {@link Account} instance that is used to get the remote mail store instance. */ private synchronized static void removeRemoteInstance(Account account) { String uri = account.getStoreUri(); if (uri.startsWith("local")) { throw new RuntimeException("Asked to get non-local Store object but given " + "LocalStore URI"); } sStores.remove(uri); } /** * Decodes the contents of store-specific URIs and puts them into a {@link ServerSettings} * object. Loading Loading @@ -208,6 +252,4 @@ public abstract class Store { public Account getAccount() { return mAccount; } } Loading
src/com/fsck/k9/Preferences.java +4 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ import java.util.Map; import android.content.Context; import android.content.SharedPreferences; import android.util.Log; import com.fsck.k9.mail.Store; import com.fsck.k9.preferences.Editor; import com.fsck.k9.preferences.Storage; Loading Loading @@ -123,6 +125,8 @@ public class Preferences { accountsInOrder.remove(account); } Store.removeAccount(account); account.delete(this); if (newAccount == account) { Loading
src/com/fsck/k9/mail/Store.java +44 −2 Original line number Diff line number Diff line Loading @@ -7,8 +7,10 @@ import java.util.concurrent.ConcurrentHashMap; import android.app.Application; import android.content.Context; import android.util.Log; import com.fsck.k9.Account; import com.fsck.k9.K9; import com.fsck.k9.mail.store.ImapStore; import com.fsck.k9.mail.store.LocalStore; import com.fsck.k9.mail.store.Pop3Store; Loading Loading @@ -111,6 +113,48 @@ public abstract class Store { } } public static void removeAccount(Account account) { try { removeRemoteInstance(account); } catch (Exception e) { Log.e(K9.LOG_TAG, "Failed to reset remote store for account " + account.getUuid(), e); } try { removeLocalInstance(account); } catch (Exception e) { Log.e(K9.LOG_TAG, "Failed to reset local store for account " + account.getUuid(), e); } } /** * Release reference to a local mail store instance. * * @param account * {@link Account} instance that is used to get the local mail store instance. */ private static void removeLocalInstance(Account account) { String accountUuid = account.getUuid(); sLocalStores.remove(accountUuid); } /** * Release reference to a remote mail store instance. * * @param account * {@link Account} instance that is used to get the remote mail store instance. */ private synchronized static void removeRemoteInstance(Account account) { String uri = account.getStoreUri(); if (uri.startsWith("local")) { throw new RuntimeException("Asked to get non-local Store object but given " + "LocalStore URI"); } sStores.remove(uri); } /** * Decodes the contents of store-specific URIs and puts them into a {@link ServerSettings} * object. Loading Loading @@ -208,6 +252,4 @@ public abstract class Store { public Account getAccount() { return mAccount; } }