Selective expunged when UIDPLUS

pull/185/head
M66B 4 years ago
parent 637c97e2da
commit c0dd77e44c

@ -588,6 +588,9 @@ class Core {
try { try {
Log.i(name + " deleting uid=" + muid + " for msgid=" + msgid); Log.i(name + " deleting uid=" + muid + " for msgid=" + msgid);
iexisting.setFlag(Flags.Flag.DELETED, true); iexisting.setFlag(Flags.Flag.DELETED, true);
if (MessageHelper.hasCapability(ifolder, "UIDPLUS"))
ifolder.expunge(new Message[]{iexisting});
else
purged = true; purged = true;
} catch (MessageRemovedException ignored) { } catch (MessageRemovedException ignored) {
Log.w(name + " existing gone uid=" + muid + " for msgid=" + msgid); Log.w(name + " existing gone uid=" + muid + " for msgid=" + msgid);
@ -760,6 +763,9 @@ class Core {
if (imessage == null) if (imessage == null)
throw new MessageRemovedException(); throw new MessageRemovedException();
imessage.setFlag(Flags.Flag.DELETED, true); imessage.setFlag(Flags.Flag.DELETED, true);
if (MessageHelper.hasCapability(ifolder, "UIDPLUS"))
ifolder.expunge(new Message[]{imessage});
else
ifolder.expunge(); ifolder.expunge();
} catch (MessagingException ex) { } catch (MessagingException ex) {
Log.w(ex); Log.w(ex);
@ -898,10 +904,13 @@ class Core {
try { try {
Log.i(folder.name + " deleting uid=" + message.uid); Log.i(folder.name + " deleting uid=" + message.uid);
iexisting.setFlag(Flags.Flag.DELETED, true); iexisting.setFlag(Flags.Flag.DELETED, true);
if (MessageHelper.hasCapability(ifolder, "UIDPLUS"))
ifolder.expunge(new Message[]{iexisting});
else
ifolder.expunge();
} catch (MessageRemovedException ignored) { } catch (MessageRemovedException ignored) {
Log.w(folder.name + " existing gone uid=" + message.uid); Log.w(folder.name + " existing gone uid=" + message.uid);
} }
ifolder.expunge();
} }
} }
@ -1018,9 +1027,13 @@ class Core {
try { try {
for (Message imessage : map.keySet()) for (Message imessage : map.keySet())
imessage.setFlag(Flags.Flag.DELETED, true); imessage.setFlag(Flags.Flag.DELETED, true);
} catch (MessageRemovedException ignored) { if (MessageHelper.hasCapability(ifolder, "UIDPLUS"))
} ifolder.expunge(map.keySet().toArray(new Message[0]));
else
ifolder.expunge(); ifolder.expunge();
} catch (MessageRemovedException ex) {
Log.w(ex);
}
} else { } else {
int count = MessageHelper.getMessageCount(ifolder); int count = MessageHelper.getMessageCount(ifolder);
db.folder().setFolderTotal(folder.id, count < 0 ? null : count); db.folder().setFolderTotal(folder.id, count < 0 ? null : count);
@ -1227,7 +1240,7 @@ class Core {
Message[] imessages = ifolder.search(new MessageIDTerm(message.msgid)); Message[] imessages = ifolder.search(new MessageIDTerm(message.msgid));
if (imessages == null) if (imessages == null)
Log.w(folder.name + " search for msgid=" + message.msgid + " returned null"); Log.w(folder.name + " search for msgid=" + message.msgid + " returned null");
else else {
for (Message iexisting : imessages) { for (Message iexisting : imessages) {
long muid = ifolder.getUID(iexisting); long muid = ifolder.getUID(iexisting);
Log.i(folder.name + " deleting uid=" + muid); Log.i(folder.name + " deleting uid=" + muid);
@ -1237,9 +1250,12 @@ class Core {
Log.w(folder.name + " existing gone uid=" + muid); Log.w(folder.name + " existing gone uid=" + muid);
} }
} }
} if (MessageHelper.hasCapability(ifolder, "UIDPLUS"))
ifolder.expunge(imessages);
else
ifolder.expunge(); ifolder.expunge();
}
}
db.message().deleteMessage(message.id); db.message().deleteMessage(message.id);
} finally { } finally {

Loading…
Cancel
Save