Revert "Generate new ID when moving message"

This reverts commit ef6ff3ecb7.
pull/153/head
M66B 6 years ago
parent ef6ff3ecb7
commit b706305135

@ -424,9 +424,8 @@ class Core {
imessage.setFlag(Flags.Flag.DRAFT, true);
// Add message
Log.i(folder.name + " ADD appending id=" + message.id);
long uid = append(istore, ifolder, imessage);
Log.i(folder.name + " ADD appended id=" + message.id + " uid=" + uid);
Log.i(folder.name + " appended id=" + message.id + " uid=" + uid);
db.message().setMessageUid(message.id, uid);
if (folder.id.equals(message.folder)) {
@ -435,9 +434,9 @@ class Core {
for (Message idelete : ideletes) {
long duid = ifolder.getUID(idelete);
if (duid == uid)
Log.i(folder.name + " ADD append confirmed uid=" + duid);
Log.i(folder.name + " append confirmed uid=" + duid);
else {
Log.i(folder.name + " ADD deleting uid=" + duid + " msgid=" + message.msgid);
Log.i(folder.name + " deleting uid=" + duid + " msgid=" + message.msgid);
idelete.setFlag(Flags.Flag.DELETED, true);
}
}
@ -481,6 +480,14 @@ class Core {
throw new FolderNotFoundException();
IMAPFolder itarget = (IMAPFolder) istore.getFolder(target.name);
// Get message ID
String msgid;
if (copy || message.msgid == null) {
msgid = EntityMessage.generateMessageId();
Log.i(target.name + " generated message id=" + msgid);
} else
msgid = message.msgid;
// Serialize source message
ByteArrayOutputStream bos = new ByteArrayOutputStream();
imessage.writeTo(bos);
@ -508,14 +515,12 @@ class Core {
if (itarget.getPermanentFlags().contains(Flags.Flag.DRAFT))
icopy.setFlag(Flags.Flag.DRAFT, true);
// Generate new ID
icopy.setHeader("Message-ID", EntityMessage.generateMessageId());
icopy.setHeader("Message-ID", msgid);
// Append target
Log.i(folder.name + " MOVE appending id=" + message.id);
long uid = append(istore, itarget, (MimeMessage) icopy);
if (newid != null) {
Log.i(folder.name + " MOVE moved id=" + newid + " uid=" + uid);
Log.i("Moved id=" + newid + " uid=" + uid);
db.message().setMessageUid(newid, uid);
}

Loading…
Cancel
Save