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

Commit 0b480d7a authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #2808 from Trogel/keep-flags-on-download-complete-message

Keep flags when downloading complete message
parents 8fc5c2db e643cbd5
Loading
Loading
Loading
Loading
+2 −24
Original line number Diff line number Diff line
@@ -2308,25 +2308,7 @@ public class MessagingController {
                // one we can't download completely. Maybe add a new flag; X_PARTIAL_MESSAGE ?
                message.setFlag(Flag.X_DOWNLOADED_FULL, true);
                message.setFlag(Flag.X_DOWNLOADED_PARTIAL, false);
            }
            /* commented out because this was pulled from another unmerged branch:
            } else if (localFolder.isLocalOnly() && !force) {
                Log.w(K9.LOG_TAG, "Message in local-only folder so cannot download fully.");
                // ASH move toast
                android.widget.Toast.makeText(mApplication,
                        "Message in local-only folder so cannot download fully",
                        android.widget.Toast.LENGTH_LONG).show();
                message.setFlag(Flag.X_DOWNLOADED_FULL, true);
                message.setFlag(Flag.X_DOWNLOADED_PARTIAL, false);
            }*/

            /*if (!message.isSet(Flag.X_DOWNLOADED_FULL)) */
            {
                /*
                 * At this point the message is not available, so we need to download it
                 * fully if possible.
                 */

            } else {
                Store remoteStore = account.getRemoteStore();
                remoteFolder = remoteStore.getFolder(folder);
                remoteFolder.open(Folder.OPEN_MODE_RW);
@@ -2340,6 +2322,7 @@ public class MessagingController {
                } else {
                    FetchProfile fp = new FetchProfile();
                    fp.add(FetchProfile.Item.BODY);
                    fp.add(FetchProfile.Item.FLAGS);
                    remoteFolder.fetch(Collections.singletonList(remoteMessage), fp, null);
                    localFolder.appendMessages(Collections.singletonList(remoteMessage));
                }
@@ -2351,11 +2334,6 @@ public class MessagingController {
                }
            }

            // Mark that this message is now fully synched
            if (account.isMarkMessageAsReadOnView()) {
                message.setFlag(Flag.SEEN, true);
            }

            // now that we have the full message, refresh the headers
            for (MessagingListener l : getListeners(listener)) {
                l.loadMessageRemoteFinished(account, folder, uid);