From 75108f4078e0a80fb1858691ccb730885bb4c21f Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 27 Nov 2010 04:03:10 +0000 Subject: [PATCH] move toMe and ccMe into LocalMessage from MessageInfoHolder --- .../fsck/k9/activity/MessageInfoHolder.java | 2 - src/com/fsck/k9/activity/MessageList.java | 4 +- src/com/fsck/k9/helper/MessageHelper.java | 19 ------ src/com/fsck/k9/mail/store/LocalStore.java | 58 +++++++++++++++++++ 4 files changed, 60 insertions(+), 23 deletions(-) diff --git a/src/com/fsck/k9/activity/MessageInfoHolder.java b/src/com/fsck/k9/activity/MessageInfoHolder.java index 4eb0e8451..4085bd92c 100644 --- a/src/com/fsck/k9/activity/MessageInfoHolder.java +++ b/src/com/fsck/k9/activity/MessageInfoHolder.java @@ -21,8 +21,6 @@ public class MessageInfoHolder public boolean downloaded; public boolean partially_downloaded; public boolean dirty; - public boolean toMe; - public boolean ccMe; public LocalMessage message; public FolderInfoHolder folder; public boolean selected; diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index f03060d0f..e0d26880c 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -2814,11 +2814,11 @@ public class MessageList private String recipientSigil (MessageInfoHolder message) { - if (message.toMe) + if (message.message.toMe()) { return getString(R.string.messagelist_sent_to_me_sigil); } - else if (message.ccMe) + else if (message.message.ccMe()) { return getString(R.string.messagelist_sent_cc_me_sigil); } diff --git a/src/com/fsck/k9/helper/MessageHelper.java b/src/com/fsck/k9/helper/MessageHelper.java index 814faba0f..0e91aa2cc 100644 --- a/src/com/fsck/k9/helper/MessageHelper.java +++ b/src/com/fsck/k9/helper/MessageHelper.java @@ -99,25 +99,6 @@ public class MessageHelper - for (Address address : message.getRecipients(RecipientType.TO)) - { - if (account.isAnIdentity(address)) - { - target.toMe = true; - } - } - - if (target.toMe == false ) - { - for(Address address : message.getRecipients(RecipientType.CC)) - { - if (account.isAnIdentity(address)) - { - target.ccMe = true; - } - } - } - target.uid = message.getUid(); diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index 71482519e..44d5f6e12 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -5918,6 +5918,12 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati private String mPreview = ""; + private boolean mToMeCalculated = false; + private boolean mCcMeCalculated = false; + private boolean mToMe = false; + private boolean mCcMe = false; + + private boolean mHeadersLoaded = false; private boolean mMessageDirty = false; @@ -6135,6 +6141,58 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati + public boolean toMe() + { + try + { if (mToMeCalculated == false) { + for (Address address : getRecipients(RecipientType.TO)) + { + if (mAccount.isAnIdentity(address)) + { + mToMe = true; + mToMeCalculated = true; + } + } + } + } catch (MessagingException e) { + // do something better than ignore this + // getRecipients can throw a messagingexception + } + return mToMe; + } + + + + + + public boolean ccMe() + { + try { + + if (mCcMeCalculated == false) { + for(Address address : getRecipients(RecipientType.CC)) + { + if (mAccount.isAnIdentity(address)) + { + mCcMe = true; + mCcMeCalculated = true; + } + } + + } + } catch (MessagingException e) { + // do something better than ignore this + // getRecipients can throw a messagingexception + } + + return mCcMe; + } + + + + + + public void setFlagInternal(Flag flag, boolean set) throws MessagingException { super.setFlag(flag, set);