Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 989e89f5 authored by Daniel Applebaum's avatar Daniel Applebaum
Browse files

Fixes Issue 1048

Zero out unread and flagged counts on all folders in an account being
cleared.

parent 6e9145f0
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -4355,13 +4355,19 @@ public class MessagingController implements Runnable
                    localStore.clear();
                    localStore.clear();
                    localStore.resetVisibleLimits(account.getDisplayCount());
                    localStore.resetVisibleLimits(account.getDisplayCount());
                    long newSize = localStore.getSize();
                    long newSize = localStore.getSize();
                    AccountStats stats = new AccountStats();
                    stats.size = newSize;
                    stats.unreadMessageCount = 0;
                    stats.flaggedMessageCount = 0;
                    if (ml != null)
                    if (ml != null)
                    {
                    {
                        ml.accountSizeChanged(account, oldSize, newSize);
                        ml.accountSizeChanged(account, oldSize, newSize);
                        ml.accountStatusChanged(account, stats);
                    }
                    }
                    for (MessagingListener l : getListeners())
                    for (MessagingListener l : getListeners())
                    {
                    {
                        l.accountSizeChanged(account, oldSize, newSize);
                        l.accountSizeChanged(account, oldSize, newSize);
                        l.accountStatusChanged(account, stats);
                    }
                    }
                }
                }
                catch (Exception e)
                catch (Exception e)
+1 −0
Original line number Original line Diff line number Diff line
@@ -309,6 +309,7 @@ public class LocalStore extends Store implements Serializable
        // Don't delete deleted messages.  They are essentially placeholders for UIDs of messages that have
        // Don't delete deleted messages.  They are essentially placeholders for UIDs of messages that have
        // been deleted locally.  They take up insignificant space
        // been deleted locally.  They take up insignificant space
        mDb.execSQL("DELETE FROM messages WHERE deleted = 0 and uid not like 'Local%'");
        mDb.execSQL("DELETE FROM messages WHERE deleted = 0 and uid not like 'Local%'");
        mDb.execSQL("update folders set flagged_count = 0, unread_count = 0");


        compact();
        compact();
        if (K9.DEBUG)
        if (K9.DEBUG)