1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 02:37:16 +00:00

Sync flags on force sync

This commit is contained in:
M66B 2021-02-19 18:07:06 +01:00
parent 60e989c52f
commit 031b1c5a23

View file

@ -2570,8 +2570,50 @@ class Core {
FetchResponse fr = (FetchResponse) response;
UID uid = fr.getItem(UID.class);
FLAGS flags = fr.getItem(FLAGS.class);
if (uid != null && (flags == null || !flags.contains(Flags.Flag.DELETED)))
uids.remove(uid.uid);
if (uid == null || flags == null)
continue;
if (perform_expunge && flags.contains(Flags.Flag.DELETED))
continue;
uids.remove(uid.uid);
if (force) {
EntityMessage message = db.message().getMessageByUid(folder.id, uid.uid);
if (message != null) {
boolean update = false;
boolean seen = flags.contains(Flags.Flag.SEEN);
boolean answered = flags.contains(Flags.Flag.ANSWERED);
boolean flagged = flags.contains(Flags.Flag.FLAGGED);
boolean deleted = flags.contains(Flags.Flag.DELETED);
if (message.seen != seen) {
update = true;
message.seen = seen;
message.ui_seen = seen;
Log.i("UID fetch seen=" + seen);
}
if (message.answered != answered) {
update = true;
message.answered = answered;
message.ui_answered = answered;
Log.i("UID fetch answered=" + answered);
}
if (message.flagged != flagged) {
update = true;
message.flagged = flagged;
message.ui_flagged = flagged;
Log.i("UID fetch flagged=" + flagged);
}
if (message.deleted != deleted) {
update = true;
message.deleted = deleted;
message.ui_deleted = deleted;
Log.i("UID fetch deleted=" + deleted);
}
if (update)
db.message().updateMessage(message);
}
}
}
} else {
for (Response response : responses)