diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index 018e246bf..6441d3e58 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -15,6 +15,7 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.fsck.k9.mail.store.LocalStore; import org.apache.commons.io.IOUtils; import android.app.AlertDialog; import android.app.Dialog; @@ -2012,34 +2013,7 @@ public class MessageView extends K9Activity implements OnClickListener } else { - // First try and fetch an HTML part. - Part part = MimeUtility.findFirstPartByMimeType(mMessage, "text/html"); - if (part == null) - { - // If that fails, try and get a text part. - part = MimeUtility.findFirstPartByMimeType(mMessage, "text/plain"); - if (part == null) - { - text = null; - } - else - { - LocalTextBody body = (LocalTextBody) part.getBody(); - if (body == null) - { - text = null; - } - else - { - text = body.getBodyForDisplay(); - } - } - } - else - { - // We successfully found an HTML part; do the necessary character set decoding. - text = MimeUtility.getTextFromPart(part); - } + text = ((LocalMessage)mMessage).getTextForDisplay(); } if (text != null) { diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index 256dd2615..c5d7bf2ac 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -5403,6 +5403,41 @@ public class LocalStore extends Store implements Serializable } + + public String getTextForDisplay() throws MessagingException + { + String text;// First try and fetch an HTML part. + Part part = MimeUtility.findFirstPartByMimeType(this, "text/html"); + if (part == null) + { + // If that fails, try and get a text part. + part = MimeUtility.findFirstPartByMimeType(this, "text/plain"); + if (part == null) + { + text = null; + } + else + { + LocalStore.LocalTextBody body = (LocalStore.LocalTextBody) part.getBody(); + if (body == null) + { + text = null; + } + else + { + text = body.getBodyForDisplay(); + } + } + } + else + { + // We successfully found an HTML part; do the necessary character set decoding. + text = MimeUtility.getTextFromPart(part); + } + return text; + } + + /* Custom version of writeTo that updates the MIME message based on localMessage * changes. */