From a78776a9ee16b5f8bb16642859b6f4f368890557 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 5 Nov 2010 04:23:04 +0000 Subject: [PATCH] Only look at the first 8k of a message when calculating message previews --- src/com/fsck/k9/mail/store/LocalStore.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index 35bc5c1b8..59c32cb98 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -2411,6 +2411,16 @@ public class LocalStore extends Store implements Serializable { return null; } + + // Only look at the first 8k of a message when calculating + // the preview. This should avoid unnecessary + // memory usage on large messages + if (text.length() > 8192) + { + text = text.substring(0,8192); + } + + text = text.replaceAll("(?m)^----.*?$",""); text = text.replaceAll("(?m)^[#>].*$",""); text = text.replaceAll("(?m)^On .*wrote.?$","");