1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 12:44:42 +00:00

Move from archive

This commit is contained in:
M66B 2018-11-30 20:08:38 +01:00
parent 7a3324d241
commit 3d543187bf

View file

@ -1552,31 +1552,24 @@ public class ServiceSynchronize extends LifecycleService {
if (imessage == null)
throw new MessageRemovedException();
if (EntityFolder.ARCHIVE.equals(folder.type) &&
!(EntityFolder.JUNK.equals(target.type) || EntityFolder.TRASH.equals(target.type))) {
if (istore.hasCapability("MOVE")) {
Folder itarget = istore.getFolder(target.name);
ifolder.moveMessages(new Message[]{imessage}, itarget);
} else {
Log.w(Helper.TAG, "MOVE by DELETE/APPEND");
// Delete source
imessage.setFlag(Flags.Flag.DELETED, true);
ifolder.expunge();
// Append target
MimeMessageEx icopy = MessageHelper.from(this, message, isession);
Folder itarget = istore.getFolder(target.name);
itarget.appendMessages(new Message[]{icopy});
db.message().setMessageUiHide(message.id, false);
} else {
if (istore.hasCapability("MOVE")) {
Folder itarget = istore.getFolder(target.name);
ifolder.moveMessages(new Message[]{imessage}, itarget);
} else {
Log.w(Helper.TAG, "MOVE by DELETE/APPEND");
if (!EntityFolder.ARCHIVE.equals(folder.type)) {
imessage.setFlag(Flags.Flag.DELETED, true);
ifolder.expunge();
}
MimeMessageEx icopy = MessageHelper.from(this, message, isession);
Folder itarget = istore.getFolder(target.name);
itarget.appendMessages(new Message[]{icopy});
}
}
if (EntityFolder.ARCHIVE.equals(folder.type))
db.message().setMessageUiHide(message.id, false);
}
private void doDelete(EntityFolder folder, IMAPFolder ifolder, EntityMessage message, JSONArray jargs, DB db) throws MessagingException, JSONException {