mirror of https://github.com/M66B/FairEmail.git
Improved delete
This commit is contained in:
parent
5d830c2d16
commit
48a348fcff
|
@ -590,25 +590,33 @@ class Core {
|
||||||
// Delete message
|
// Delete message
|
||||||
DB db = DB.getInstance(context);
|
DB db = DB.getInstance(context);
|
||||||
|
|
||||||
Message[] imessages;
|
if (message.uid != null) {
|
||||||
if (TextUtils.isEmpty(message.msgid))
|
Message iexisting = ifolder.getMessageByUID(message.uid);
|
||||||
if (message.uid == null)
|
if (iexisting == null)
|
||||||
throw new IllegalArgumentException("Delete without ID");
|
Log.w(folder.name + " existing not found uid=" + message.uid);
|
||||||
else {
|
else
|
||||||
Message imessage = ifolder.getMessageByUID(message.uid);
|
try {
|
||||||
if (imessage == null)
|
Log.i(folder.name + " deleting uid=" + message.uid);
|
||||||
throw new MessageRemovedException();
|
iexisting.setFlag(Flags.Flag.DELETED, true);
|
||||||
imessages = new Message[]{imessage};
|
} catch (MessageRemovedException ignored) {
|
||||||
}
|
Log.w(folder.name + " existing gone uid=" + message.uid);
|
||||||
else
|
}
|
||||||
imessages = ifolder.search(new MessageIDTerm(message.msgid));
|
}
|
||||||
|
|
||||||
for (Message imessage : imessages) {
|
if (!TextUtils.isEmpty(message.msgid)) {
|
||||||
Log.i(folder.name + " deleting uid=" + message.uid + " msgid=" + message.msgid);
|
Message[] imessages = ifolder.search(new MessageIDTerm(message.msgid));
|
||||||
try {
|
if (imessages == null)
|
||||||
imessage.setFlag(Flags.Flag.DELETED, true);
|
Log.w(folder.name + " search for msgid=" + message.msgid + " returned null");
|
||||||
} catch (MessageRemovedException ignored) {
|
else
|
||||||
}
|
for (Message iexisting : imessages) {
|
||||||
|
long muid = ifolder.getUID(iexisting);
|
||||||
|
Log.i(folder.name + " deleting uid=" + muid);
|
||||||
|
try {
|
||||||
|
iexisting.setFlag(Flags.Flag.DELETED, true);
|
||||||
|
} catch (MessageRemovedException ignored) {
|
||||||
|
Log.w(folder.name + " existing gone uid=" + muid);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ifolder.expunge();
|
ifolder.expunge();
|
||||||
|
|
Loading…
Reference in New Issue