Added workaround for drafts flag

This commit is contained in:
M66B 2019-02-02 19:28:44 +00:00
parent d5758bf575
commit a17b112320
1 changed files with 11 additions and 0 deletions

View File

@ -1827,6 +1827,7 @@ public class ServiceSynchronize extends LifecycleService {
Log.i(folder.name + " appended id=" + message.id + " uid=" + uid);
db.message().setMessageUid(message.id, uid);
// Some providers, like Gmail, don't honor the appended seen flag
if (itarget.getPermanentFlags().contains(Flags.Flag.SEEN)) {
boolean seen = (autoread || message.ui_seen);
icopy = itarget.getMessageByUID(uid);
@ -1836,6 +1837,16 @@ public class ServiceSynchronize extends LifecycleService {
}
}
// This is not based on an actual case, so this is just a safeguard
if (itarget.getPermanentFlags().contains(Flags.Flag.DRAFT)) {
boolean draft = EntityFolder.DRAFTS.equals(target.type);
icopy = itarget.getMessageByUID(uid);
if (draft != icopy.isSet(Flags.Flag.DRAFT)) {
Log.i(folder.name + " Fixing id=" + message.id + " draft=" + draft);
icopy.setFlag(Flags.Flag.DRAFT, draft);
}
}
// Delete source
imessage.setFlag(Flags.Flag.DELETED, true);
ifolder.expunge();