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

Fixed issue 3530.

Should not HTMLify the message when it is sent without quoted message.

The problem is:
1. set MessageFormat in Account setting to the TEXT.
2. reply a message without quoted text.
3. it is sent with HTML tags.
This commit is contained in:
Koji Arai 2011-06-16 00:35:27 +09:00
parent 2e173150d5
commit 45e29ccba4

View File

@ -909,29 +909,16 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
String text = mMessageContentView.getText().toString(); String text = mMessageContentView.getText().toString();
boolean discardQuotedText = false; boolean saveQuotedText = false;
if (!isDraft && !mQuotedTextMode.equals(QuotedTextMode.SHOW)) { if (isDraft || mQuotedTextMode.equals(QuotedTextMode.SHOW)) {
discardQuotedText = true; saveQuotedText = true;
} }
if (discardQuotedText) {
if (!isDraft) {
text = appendSignature(text);
}
text = HtmlConverter.textToHtmlFragment(text);
// Build the body.
TextBody body = new TextBody(text);
body.setComposedMessageLength(text.length());
body.setComposedMessageOffset(0);
return body;
}
// Handle HTML separate from the rest of the text content. HTML mode doesn't allow signature after the quoted // Handle HTML separate from the rest of the text content. HTML mode doesn't allow signature after the quoted
// text, nor does it allow reply after quote. Users who want that functionality will need to stick with text // text, nor does it allow reply after quote. Users who want that functionality will need to stick with text
// mode. // mode.
else if (mMessageFormat == MessageFormat.HTML) { if (mMessageFormat == MessageFormat.HTML) {
// Add the signature. // Add the signature.
if (!isDraft) { if (!isDraft) {
text = appendSignature(text); text = appendSignature(text);
@ -940,7 +927,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
// Insert it into the existing content object. // Insert it into the existing content object.
if (K9.DEBUG && mQuotedHtmlContent != null) if (K9.DEBUG && mQuotedHtmlContent != null)
Log.d(K9.LOG_TAG, "insertable: " + mQuotedHtmlContent.toDebugString()); Log.d(K9.LOG_TAG, "insertable: " + mQuotedHtmlContent.toDebugString());
if (mQuotedHtmlContent != null) { if (mQuotedHtmlContent != null && saveQuotedText) {
// Set the insertion location based upon our reply after quote setting. Reply after // Set the insertion location based upon our reply after quote setting. Reply after
// quote makes no sense for HEADER style replies. In addition, add some extra // quote makes no sense for HEADER style replies. In addition, add some extra
@ -981,11 +968,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
Integer composedMessageOffset = 0; Integer composedMessageOffset = 0;
// Placing the signature before the quoted text does not make sense if replyAfterQuote is true. // Placing the signature before the quoted text does not make sense if replyAfterQuote is true.
if (!replyAfterQuote && !isDraft && mAccount.isSignatureBeforeQuotedText()) { if (!isDraft) {
text = appendSignature(text); if (!replyAfterQuote && mAccount.isSignatureBeforeQuotedText()) {
text = appendSignature(text);
}
} }
if (mQuotedTextMode != QuotedTextMode.NONE) { if (saveQuotedText) {
if (replyAfterQuote) { if (replyAfterQuote) {
composedMessageOffset = mQuotedText.getText().toString().length() + "\n".length(); composedMessageOffset = mQuotedText.getText().toString().length() + "\n".length();
text = mQuotedText.getText().toString() + "\n" + text; text = mQuotedText.getText().toString() + "\n" + text;
@ -996,10 +985,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
// Note: If user has selected reply after quote AND signature before quote, ignore the // Note: If user has selected reply after quote AND signature before quote, ignore the
// latter setting and append the signature at the end. // latter setting and append the signature at the end.
if (!isDraft && (!mAccount.isSignatureBeforeQuotedText() || replyAfterQuote)) { if (!isDraft) {
text = appendSignature(text); if (replyAfterQuote || !mAccount.isSignatureBeforeQuotedText()) {
text = appendSignature(text);
}
} }
// Build the body. // Build the body.
TextBody body = new TextBody(text); TextBody body = new TextBody(text);
body.setComposedMessageLength(composedMessageLength); body.setComposedMessageLength(composedMessageLength);