From d301d632745065760037c79d8d131ac13cd44768 Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 25 Jun 2015 22:47:17 +0200 Subject: [PATCH] Add support for saving message/rfc822 parts Fixes #603 --- .../main/java/com/fsck/k9/mailstore/LocalFolder.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 7f8fa7bef..e01c4d93c 100644 --- a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalFolder.java +++ b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalFolder.java @@ -1311,6 +1311,8 @@ public class LocalFolder extends Folder implements Serializable { multipartToContentValues(cv, (Multipart) body); } else if (body == null) { missingPartToContentValues(cv, part); + } else if (body instanceof Message) { + messageMarkerToContentValues(cv); } else { file = leafPartToContentValues(cv, part, body); } @@ -1344,6 +1346,10 @@ public class LocalFolder extends Folder implements Serializable { cv.put("decoded_body_size", attachment.size); } + private void messageMarkerToContentValues(ContentValues cv) throws MessagingException { + cv.put("data_location", DataLocation.CHILD_PART_CONTAINS_DATA); + } + private File leafPartToContentValues(ContentValues cv, Part part, Body body) throws MessagingException, IOException { AttachmentViewInfo attachment = LocalMessageExtractor.extractAttachmentInfo(part); @@ -1466,6 +1472,9 @@ public class LocalFolder extends Folder implements Serializable { BodyPart childPart = multipart.getBodyPart(i); stack.push(new PartContainer(parentMessageId, childPart)); } + } else if (body instanceof Message) { + Message innerMessage = (Message) body; + stack.push(new PartContainer(parentMessageId, innerMessage)); } } @@ -1994,5 +2003,6 @@ public class LocalFolder extends Folder implements Serializable { static final int MISSING = 0; static final int IN_DATABASE = 1; static final int ON_DISK = 2; + static final int CHILD_PART_CONTAINS_DATA = 3; } }