1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Remove 'dirty' check for LocalMessage

This commit is contained in:
cketti 2015-01-05 02:24:56 +01:00
parent 3eb25a011f
commit 523ebd0f2a

View File

@ -37,7 +37,6 @@ public class LocalMessage extends MimeMessage {
private String mPreview = ""; private String mPreview = "";
private boolean mHeadersLoaded = false; private boolean mHeadersLoaded = false;
private boolean mMessageDirty = false;
private long mThreadId; private long mThreadId;
private long mRootId; private long mRootId;
@ -142,30 +141,13 @@ public class LocalMessage extends MimeMessage {
@Override @Override
public void writeTo(OutputStream out) throws IOException, MessagingException { public void writeTo(OutputStream out) throws IOException, MessagingException {
if (mMessageDirty) buildMimeRepresentation(); if (!mHeadersLoaded) {
loadHeaders();
}
super.writeTo(out); super.writeTo(out);
} }
void buildMimeRepresentation() throws MessagingException {
if (!mMessageDirty) {
return;
}
super.setSubject(mSubject);
if (this.mFrom != null && this.mFrom.length > 0) {
super.setFrom(this.mFrom[0]);
}
super.setReplyTo(mReplyTo);
super.setSentDate(this.getSentDate(), K9.hideTimeZone());
super.setRecipients(RecipientType.TO, mTo);
super.setRecipients(RecipientType.CC, mCc);
super.setRecipients(RecipientType.BCC, mBcc);
if (mMessageId != null) super.setMessageId(mMessageId);
mMessageDirty = false;
}
@Override @Override
public String getPreview() { public String getPreview() {
return mPreview; return mPreview;
@ -180,14 +162,12 @@ public class LocalMessage extends MimeMessage {
@Override @Override
public void setSubject(String subject) throws MessagingException { public void setSubject(String subject) throws MessagingException {
mSubject = subject; mSubject = subject;
mMessageDirty = true;
} }
@Override @Override
public void setMessageId(String messageId) { public void setMessageId(String messageId) {
mMessageId = messageId; mMessageId = messageId;
mMessageDirty = true;
} }
@Override @Override
@ -208,7 +188,6 @@ public class LocalMessage extends MimeMessage {
@Override @Override
public void setFrom(Address from) throws MessagingException { public void setFrom(Address from) throws MessagingException {
this.mFrom = new Address[] { from }; this.mFrom = new Address[] { from };
mMessageDirty = true;
} }
@ -219,7 +198,6 @@ public class LocalMessage extends MimeMessage {
} else { } else {
mReplyTo = replyTo; mReplyTo = replyTo;
} }
mMessageDirty = true;
} }
@ -250,7 +228,6 @@ public class LocalMessage extends MimeMessage {
} else { } else {
throw new MessagingException("Unrecognized recipient type."); throw new MessagingException("Unrecognized recipient type.");
} }
mMessageDirty = true;
} }
public void setFlagInternal(Flag flag, boolean set) throws MessagingException { public void setFlagInternal(Flag flag, boolean set) throws MessagingException {
@ -557,7 +534,6 @@ public class LocalMessage extends MimeMessage {
message.mSubject = mSubject; message.mSubject = mSubject;
message.mPreview = mPreview; message.mPreview = mPreview;
message.mHeadersLoaded = mHeadersLoaded; message.mHeadersLoaded = mHeadersLoaded;
message.mMessageDirty = mMessageDirty;
return message; return message;
} }