1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 20:54:34 +00:00

Improved late draft logic

This commit is contained in:
M66B 2022-08-30 18:42:22 +02:00
parent 2b813ad2ce
commit 20047afc41

View file

@ -4055,16 +4055,27 @@ class Core {
message = dup; message = dup;
process = true; process = true;
} else if (dup.uid < uid && EntityFolder.DRAFTS.equals(folder.type)) { } else if (msgid != null && EntityFolder.DRAFTS.equals(folder.type)) {
try { try {
Message existing = ifolder.getMessageByUID(dup.uid); if (dup.uid < uid) {
Log.e(folder.name + " late draft host=" + account.host + MimeMessage existing = (MimeMessage) ifolder.getMessageByUID(dup.uid);
" uid=" + dup.uid + "<" + uid + " found=" + (existing != null)); if (existing != null &&
if (existing != null) { msgid.equals(existing.getHeader(MessageHelper.HEADER_CORRELATION_ID, null))) {
Log.e(folder.name + " late draft" +
" host=" + account.host + " uid=" + dup.uid + "<" + uid);
existing.setFlag(Flags.Flag.DELETED, true); existing.setFlag(Flags.Flag.DELETED, true);
expunge(context, ifolder, Arrays.asList(existing)); expunge(context, ifolder, Arrays.asList(existing));
db.message().setMessageUiHide(dup.id, true); db.message().setMessageUiHide(dup.id, true);
} }
} else if (dup.uid > uid) {
if (msgid.equals(imessage.getHeader(MessageHelper.HEADER_CORRELATION_ID, null))) {
Log.e(folder.name + " late draft" +
" host=" + account.host + " uid=" + dup.uid + ">" + uid);
imessage.setFlag(Flags.Flag.DELETED, true);
expunge(context, ifolder, Arrays.asList(imessage));
return null;
}
}
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
} }