mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-11 20:15:03 -05:00
Minor perf optimization using addHeader() instead of setHeader()
This commit is contained in:
parent
ba1cba77b8
commit
02e41e6da0
@ -675,9 +675,9 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
for (int i = 0, count = mAttachments.getChildCount(); i < count; i++) {
|
||||
Attachment attachment = (Attachment) mAttachments.getChildAt(i).getTag();
|
||||
MimeBodyPart bp = new MimeBodyPart( new LocalStore.LocalAttachmentBody(attachment.uri, getApplication()));
|
||||
bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\n name=\"%s\"", attachment.contentType, attachment.name));
|
||||
bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
|
||||
bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format("attachment;\n filename=\"%s\"", attachment.name));
|
||||
bp.addHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\n name=\"%s\"", attachment.contentType, attachment.name));
|
||||
bp.addHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
|
||||
bp.addHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format("attachment;\n filename=\"%s\"", attachment.name));
|
||||
mp.addBodyPart(bp);
|
||||
}
|
||||
|
||||
@ -749,7 +749,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
}
|
||||
|
||||
Log.d(Email.LOG_TAG, "Saving identity: " + k9identity);
|
||||
message.setHeader(Email.K9MAIL_IDENTITY, k9identity);
|
||||
message.addHeader(Email.K9MAIL_IDENTITY, k9identity);
|
||||
|
||||
MessagingController.getInstance(getApplication()).saveDraft(mAccount, message);
|
||||
mDraftUid = message.getUid();
|
||||
|
@ -29,7 +29,7 @@ public class MimeBodyPart extends BodyPart {
|
||||
|
||||
public MimeBodyPart(Body body, String mimeType) throws MessagingException {
|
||||
if (mimeType != null) {
|
||||
setHeader(MimeHeader.HEADER_CONTENT_TYPE, mimeType);
|
||||
addHeader(MimeHeader.HEADER_CONTENT_TYPE, mimeType);
|
||||
}
|
||||
setBody(body);
|
||||
}
|
||||
@ -72,6 +72,10 @@ public class MimeBodyPart extends BodyPart {
|
||||
contentType += String.format(";\n name=\"%s\"", name);
|
||||
}
|
||||
setHeader(MimeHeader.HEADER_CONTENT_TYPE, contentType);
|
||||
//TODO: Use quoted-printable
|
||||
//using org.apache.commons.codec.net.QuotedPrintableCodec
|
||||
//when it will implement all rules (missing #3, $4 & #5) of the RFC
|
||||
//http://www.ietf.org/rfc/rfc1521.txt
|
||||
setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
|
||||
}
|
||||
}
|
||||
|
@ -44,9 +44,8 @@ public class MimeMessage extends Message {
|
||||
protected int mSize;
|
||||
|
||||
public MimeMessage() {
|
||||
setHeader("Message-ID", generateMessageId());
|
||||
|
||||
}
|
||||
addHeader("Message-ID", generateMessageId());
|
||||
}
|
||||
|
||||
private String generateMessageId() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
@ -916,7 +916,7 @@ public class LocalStore extends Store implements Serializable {
|
||||
message.setReplyTo(Address.unpack(cursor.getString(9)));
|
||||
message.mAttachmentCount = cursor.getInt(10);
|
||||
message.setInternalDate(new Date(cursor.getLong(11)));
|
||||
message.setHeader("Message-ID", cursor.getString(12));
|
||||
message.addHeader("Message-ID", cursor.getString(12));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user