mirror of https://github.com/M66B/FairEmail.git
Support moving from/to drafts
This commit is contained in:
parent
0ed815fff7
commit
da0f528798
|
@ -591,6 +591,24 @@ class Core {
|
||||||
throw new FolderNotFoundException();
|
throw new FolderNotFoundException();
|
||||||
IMAPFolder itarget = (IMAPFolder) istore.getFolder(target.name);
|
IMAPFolder itarget = (IMAPFolder) istore.getFolder(target.name);
|
||||||
|
|
||||||
|
if (EntityFolder.DRAFTS.equals(folder.type) || EntityFolder.DRAFTS.equals(target.type)) {
|
||||||
|
Log.i(folder.name + " move from " + folder.type + " to " + target.type);
|
||||||
|
|
||||||
|
File file = message.getRawFile(context);
|
||||||
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
||||||
|
imessage.writeTo(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
Message icopy;
|
||||||
|
try (InputStream is = new BufferedInputStream(new FileInputStream(file))) {
|
||||||
|
icopy = new MimeMessage(isession, is);
|
||||||
|
}
|
||||||
|
|
||||||
|
file.delete();
|
||||||
|
|
||||||
|
icopy.setFlag(Flags.Flag.DRAFT, EntityFolder.DRAFTS.equals(target.type));
|
||||||
|
itarget.appendMessages(new Message[]{icopy});
|
||||||
|
} else
|
||||||
ifolder.copyMessages(new Message[]{imessage}, itarget);
|
ifolder.copyMessages(new Message[]{imessage}, itarget);
|
||||||
|
|
||||||
// Delete source
|
// Delete source
|
||||||
|
|
Loading…
Reference in New Issue