Loading k9mail/src/main/java/com/fsck/k9/controller/MessagingController.java +16 −12 Original line number Diff line number Diff line Loading @@ -971,7 +971,7 @@ public class MessagingController implements Runnable { /* * Now we download the actual content of messages. */ int newMessages = downloadMessages(account, remoteFolder, localFolder, remoteMessages, false); int newMessages = downloadMessages(account, remoteFolder, localFolder, remoteMessages, false, true); int unreadMessageCount = localFolder.getUnreadMessageCount(); for (MessagingListener l : getListeners()) { Loading Loading @@ -1108,6 +1108,8 @@ public class MessagingController implements Runnable { * A list of messages objects that store the UIDs of which messages to download. * @param flagSyncOnly * Only flags will be fetched from the remote store if this is {@code true}. * @param purgeToVisibleLimit * If true, local messages will be purged down to the limit of visible messages. * * @return The number of downloaded messages that are not flagged as {@link Flag#SEEN}. * Loading @@ -1115,7 +1117,7 @@ public class MessagingController implements Runnable { */ private int downloadMessages(final Account account, final Folder remoteFolder, final LocalFolder localFolder, List<Message> inputMessages, boolean flagSyncOnly) throws MessagingException { boolean flagSyncOnly, boolean purgeToVisibleLimit) throws MessagingException { final Date earliestDate = account.getEarliestPollDate(); Date downloadStarted = new Date(); // now Loading Loading @@ -1233,6 +1235,7 @@ public class MessagingController implements Runnable { if (K9.DEBUG) Log.d(K9.LOG_TAG, "SYNC: Synced remote messages for folder " + folder + ", " + newMessages.get() + " new messages"); if (purgeToVisibleLimit) { localFolder.purgeToVisibleLimit(new MessageRemovalListener() { @Override public void messageRemoved(Message message) { Loading @@ -1242,6 +1245,7 @@ public class MessagingController implements Runnable { } }); } // If the oldest message seen on this sync is newer than // the oldest message seen on the previous sync, then Loading Loading @@ -2770,7 +2774,7 @@ public class MessagingController implements Runnable { if (loadPartialFromSearch) { downloadMessages(account, remoteFolder, localFolder, Collections.singletonList(remoteMessage), false); Collections.singletonList(remoteMessage), false, false); } else { FetchProfile fp = new FetchProfile(); fp.add(FetchProfile.Item.BODY); Loading Loading @@ -4562,7 +4566,7 @@ public class MessagingController implements Runnable { localFolder.open(Folder.OPEN_MODE_RW); account.setRingNotified(false); int newCount = downloadMessages(account, remoteFolder, localFolder, messages, flagSyncOnly); int newCount = downloadMessages(account, remoteFolder, localFolder, messages, flagSyncOnly, true); int unreadMessageCount = localFolder.getUnreadMessageCount(); Loading Loading
k9mail/src/main/java/com/fsck/k9/controller/MessagingController.java +16 −12 Original line number Diff line number Diff line Loading @@ -971,7 +971,7 @@ public class MessagingController implements Runnable { /* * Now we download the actual content of messages. */ int newMessages = downloadMessages(account, remoteFolder, localFolder, remoteMessages, false); int newMessages = downloadMessages(account, remoteFolder, localFolder, remoteMessages, false, true); int unreadMessageCount = localFolder.getUnreadMessageCount(); for (MessagingListener l : getListeners()) { Loading Loading @@ -1108,6 +1108,8 @@ public class MessagingController implements Runnable { * A list of messages objects that store the UIDs of which messages to download. * @param flagSyncOnly * Only flags will be fetched from the remote store if this is {@code true}. * @param purgeToVisibleLimit * If true, local messages will be purged down to the limit of visible messages. * * @return The number of downloaded messages that are not flagged as {@link Flag#SEEN}. * Loading @@ -1115,7 +1117,7 @@ public class MessagingController implements Runnable { */ private int downloadMessages(final Account account, final Folder remoteFolder, final LocalFolder localFolder, List<Message> inputMessages, boolean flagSyncOnly) throws MessagingException { boolean flagSyncOnly, boolean purgeToVisibleLimit) throws MessagingException { final Date earliestDate = account.getEarliestPollDate(); Date downloadStarted = new Date(); // now Loading Loading @@ -1233,6 +1235,7 @@ public class MessagingController implements Runnable { if (K9.DEBUG) Log.d(K9.LOG_TAG, "SYNC: Synced remote messages for folder " + folder + ", " + newMessages.get() + " new messages"); if (purgeToVisibleLimit) { localFolder.purgeToVisibleLimit(new MessageRemovalListener() { @Override public void messageRemoved(Message message) { Loading @@ -1242,6 +1245,7 @@ public class MessagingController implements Runnable { } }); } // If the oldest message seen on this sync is newer than // the oldest message seen on the previous sync, then Loading Loading @@ -2770,7 +2774,7 @@ public class MessagingController implements Runnable { if (loadPartialFromSearch) { downloadMessages(account, remoteFolder, localFolder, Collections.singletonList(remoteMessage), false); Collections.singletonList(remoteMessage), false, false); } else { FetchProfile fp = new FetchProfile(); fp.add(FetchProfile.Item.BODY); Loading Loading @@ -4562,7 +4566,7 @@ public class MessagingController implements Runnable { localFolder.open(Folder.OPEN_MODE_RW); account.setRingNotified(false); int newCount = downloadMessages(account, remoteFolder, localFolder, messages, flagSyncOnly); int newCount = downloadMessages(account, remoteFolder, localFolder, messages, flagSyncOnly, true); int unreadMessageCount = localFolder.getUnreadMessageCount(); Loading