Update modseq after sync

This commit is contained in:
M66B 2021-04-08 07:57:28 +02:00
parent 33c96d3e2a
commit 05d7aa3c8e
2 changed files with 18 additions and 14 deletions

View File

@ -2460,7 +2460,7 @@ class Core {
boolean sync_flagged = prefs.getBoolean("sync_flagged", false);
boolean sync_kept = prefs.getBoolean("sync_kept", true);
boolean delete_unseen = prefs.getBoolean("delete_unseen", false);
boolean use_modseq = prefs.getBoolean("use_modseq", BuildConfig.DEBUG);
boolean use_modseq = prefs.getBoolean("use_modseq", true);
boolean perform_expunge = prefs.getBoolean("perform_expunge", true);
Log.i(folder.name + " start sync after=" + sync_days + "/" + keep_days +
@ -2485,16 +2485,15 @@ class Core {
// https://tools.ietf.org/html/rfc4551
// https://wiki.mozilla.org/Thunderbird:IMAP_RFC_4551_Implementation
Long modseq = null;
boolean modified = true;
if (use_modseq)
try {
if (use_modseq &&
MessageHelper.hasCapability(ifolder, "CONDSTORE")) {
long modseq = ifolder.getHighestModSeq();
Log.i(folder.name + " modseq=" + modseq + "/" + folder.modseq);
if (MessageHelper.hasCapability(ifolder, "CONDSTORE")) {
modseq = ifolder.getHighestModSeq();
modified = (force || initialize != 0 ||
folder.modseq == null || !folder.modseq.equals(modseq));
folder.modseq = modseq;
db.folder().setFolderModSeq(folder.id, folder.modseq);
Log.i(folder.name + " modseq=" + modseq + "/" + folder.modseq + " modified=" + modified);
}
} catch (MessagingException ex) {
Log.w(folder.name, ex);
@ -2906,6 +2905,11 @@ class Core {
Log.i(folder.name + " deleted orphans=" + orphans);
}
// Update modseq
folder.modseq = modseq;
db.folder().setFolderModSeq(folder.id, folder.modseq);
// Update stats
int count = MessageHelper.getMessageCount(ifolder);
db.folder().setFolderTotal(folder.id, count < 0 ? null : count);
account.last_connected = new Date().getTime();

View File

@ -930,7 +930,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swDebug.setChecked(prefs.getBoolean("debug", false));
swQueries.setChecked(prefs.getInt("query_threads", 4) < 4);
swWal.setChecked(prefs.getBoolean("wal", true));
swModSeq.setChecked(prefs.getBoolean("use_modseq", BuildConfig.DEBUG));
swModSeq.setChecked(prefs.getBoolean("use_modseq", true));
swExpunge.setChecked(prefs.getBoolean("perform_expunge", true));
swAuthPlain.setChecked(prefs.getBoolean("auth_plain", true));
swAuthLogin.setChecked(prefs.getBoolean("auth_login", true));