From b495f1ed91773e9cc1050d5ce6defce6769c7384 Mon Sep 17 00:00:00 2001 From: "rhp%netscape.com" Date: Thu, 9 Mar 2000 00:09:18 +0000 Subject: [PATCH] Fix for quoting problem with line wrap - Bug #: 30562 - r: rhp - worked on with Ben Bucksch - a: phil --- mailnews/mime/src/mimetpfl.cpp | 36 +++++++++++++++++++++------------- mailnews/mime/src/mimetpla.cpp | 33 ++++++++++++++++++++----------- 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/mailnews/mime/src/mimetpfl.cpp b/mailnews/mime/src/mimetpfl.cpp index ecfc9772de5b..87023e9235ce 100644 --- a/mailnews/mime/src/mimetpfl.cpp +++ b/mailnews/mime/src/mimetpfl.cpp @@ -281,26 +281,34 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob mozITXTToHTMLConv *conv = GetTextConverter(obj->options); - // If we have been told not to mess with this text, then don't do this search..or if the converter - // is null for some reason - PRBool skipScanning = (!conv) || - (obj->options && obj->options->force_user_charset) || - (obj->options && (obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting)) || - (obj->options && (obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting) || - (obj->options && (obj->options->format_out == nsMimeOutput::nsMimeMessageSaveAs))); - - if (!skipScanning) + PRBool skipConversion = + !conv || + ( obj->options + && + ( + obj->options->force_user_charset || + obj->options->format_out == nsMimeOutput::nsMimeMessageSaveAs + ) ); + + if (!skipConversion) { //XXX I18N Converting char* to PRUnichar* nsString strline(linep, (length - (linep - line)) ); PRUnichar* wresult = nsnull; nsresult rv = NS_OK; + PRBool whattodo = obj->options->whattodo; + if + ( + obj->options + && + ( + obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting || + obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting + ) + ) + whattodo = 0; - // we should modify scantxt to take a char * instead of a unicode string so we can - // reduce the number of string copying going on. - - rv = conv->ScanTXT(strline.GetUnicode(),obj->options->whattodo, &wresult); - + rv = conv->ScanTXT(strline.GetUnicode(), whattodo, &wresult); if (NS_FAILED(rv)) return -1; diff --git a/mailnews/mime/src/mimetpla.cpp b/mailnews/mime/src/mimetpla.cpp index 620ddbc8aebe..dbfabcbb367f 100644 --- a/mailnews/mime/src/mimetpla.cpp +++ b/mailnews/mime/src/mimetpla.cpp @@ -153,6 +153,7 @@ MimeInlineTextPlain_parse_line (char *line, PRInt32 length, MimeObject *obj) // Ok, there is always the issue of guessing how much space we will need for emoticons. // So what we will do is count the total number of "special" chars and multiply by 82 // (max len for a smiley line) and add one for good measure + //XXX: make dynamic PRInt32 specialCharCount = 0; for (PRInt32 z=0; zoptions); - // If we have been told not to mess with this text, then don't do this search! - PRBool skipScanning = (!conv) || - (obj->options && obj->options->force_user_charset) || - (obj->options && (obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting)) || - (obj->options && (obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting)) || - (obj->options && (obj->options->format_out == nsMimeOutput::nsMimeMessageSaveAs)); + PRBool skipConversion = + !conv || + ( obj->options && + ( + obj->options->force_user_charset || + obj->options->format_out == nsMimeOutput::nsMimeMessageSaveAs + ) ); - if (!skipScanning) + if (!skipConversion) { nsString strline(line, length); nsresult rv = NS_OK; PRUnichar* wresult = nsnull; - - // we should force scanTXT to take a char * instead of a unicode string - // so we don't have to make an extra copy of the line just to convert it to unicode - rv = conv->ScanTXT(strline.GetUnicode(), obj->options->whattodo, &wresult); + PRBool whattodo = obj->options->whattodo; + if + ( + obj->options + && + ( + obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting || + obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting + ) + ) + whattodo = 0; + + rv = conv->ScanTXT(strline.GetUnicode(), whattodo, &wresult); if (NS_FAILED(rv)) return -1;