From 41bd420213b1ca6b1b66f435322d297714966f26 Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 15 Jan 2015 23:35:50 +0100 Subject: [PATCH] Include database ID in message parts reconstructed from the database --- .../com/fsck/k9/mailstore/LocalBodyPart.java | 27 +++++++++++++++++++ .../com/fsck/k9/mailstore/LocalFolder.java | 2 +- .../java/com/fsck/k9/mailstore/LocalPart.java | 7 +++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 k9mail/src/main/java/com/fsck/k9/mailstore/LocalBodyPart.java create mode 100644 k9mail/src/main/java/com/fsck/k9/mailstore/LocalPart.java diff --git a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalBodyPart.java b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalBodyPart.java new file mode 100644 index 000000000..3ea9820a6 --- /dev/null +++ b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalBodyPart.java @@ -0,0 +1,27 @@ +package com.fsck.k9.mailstore; + + +import com.fsck.k9.mail.MessagingException; +import com.fsck.k9.mail.internet.MimeBodyPart; + + +public class LocalBodyPart extends MimeBodyPart implements LocalPart { + private final String accountUuid; + private final long messagePartId; + + public LocalBodyPart(String accountUuid, long messagePartId) throws MessagingException { + super(); + this.accountUuid = accountUuid; + this.messagePartId = messagePartId; + } + + @Override + public String getAccountUuid() { + return accountUuid; + } + + @Override + public long getId() { + return messagePartId; + } +} diff --git a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalFolder.java b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalFolder.java index d15fdec2e..708681241 100644 --- a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalFolder.java +++ b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalFolder.java @@ -686,7 +686,7 @@ public class LocalFolder extends Folder implements Serializable { String parentMimeType = parentPart.getMimeType(); if (parentMimeType.startsWith("multipart/")) { - BodyPart bodyPart = new MimeBodyPart(); + BodyPart bodyPart = new LocalBodyPart(getAccountUuid(), id); ((Multipart) parentPart.getBody()).addBodyPart(bodyPart); part = bodyPart; } else if (parentMimeType.startsWith("message/")) { diff --git a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalPart.java b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalPart.java new file mode 100644 index 000000000..239595716 --- /dev/null +++ b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalPart.java @@ -0,0 +1,7 @@ +package com.fsck.k9.mailstore; + + +public interface LocalPart { + String getAccountUuid(); + long getId(); +}