Bug 314351 - Reply to .EML or message/rfc822: problems with MIME-encoded Subject. r=dbienvenu
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Tue, 21 Feb 2012 19:26:09 +0900
changeset 10874 fc98c220816a27f9c94eec31bafa1167ce7ef661
parent 10873 843f0c541a64cc6b1e8775d9bb1dbfa31ef74b04
child 10875 348640b81582a4c74d73b6d19a6b89f1ec50f2f8
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbienvenu
bugs314351
Bug 314351 - Reply to .EML or message/rfc822: problems with MIME-encoded Subject. r=dbienvenu
mailnews/compose/src/nsMsgCompose.cpp
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -1776,18 +1776,16 @@ nsresult nsMsgCompose::CreateMessage(con
 
     return NS_OK;
   }
 
   char *uriList = PL_strdup(originalMsgURI);
   if (!uriList)
     return NS_ERROR_OUT_OF_MEMORY;
 
-  nsCOMPtr<nsIMimeConverter> mimeConverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID);
-
   nsCString charset;
   // use a charset of the original message
   nsCString mailCharset;
   bool charsetOverride = false;
   GetTopmostMsgWindowCharacterSet(mailCharset, &mCharsetOverride);
   if (!mailCharset.IsEmpty())
   {
     charset = mailCharset;
@@ -1825,17 +1823,16 @@ nsresult nsMsgCompose::CreateMessage(con
       msgHdr = mOrigMsgHdr;
     else
     {
       rv = GetMsgDBHdrFromURI(uri, getter_AddRefs(msgHdr));
       NS_ENSURE_SUCCESS(rv,rv);
     }
     if (msgHdr)
     {
-      nsString subject;
       nsCString decodedCString;
 
       if (!charsetOverride && charset.IsEmpty())
       {
         rv = msgHdr->GetCharset(getter_Copies(charset));
         if (NS_FAILED(rv)) return rv;
       }
 
@@ -1862,20 +1859,18 @@ nsresult nsMsgCompose::CreateMessage(con
       if (charset.Equals("x-windows-949",
             nsCaseInsensitiveCStringComparator()))
         charset = "EUC-KR";
 
       // get an original charset, used for a label, UTF-8 is used for the internal processing
       if (isFirstPass && !charset.IsEmpty())
         m_compFields->SetCharacterSet(charset.get());
 
-      nsCString subjectCStr;
-      (void) msgHdr->GetSubject(getter_Copies(subjectCStr));
-      rv = mimeConverter->DecodeMimeHeader(subjectCStr.get(), originCharset.get(),
-                                           charsetOverride, true, subject);
+      nsString subject;
+      rv = msgHdr->GetMime2DecodedSubject(subject);
       if (NS_FAILED(rv)) return rv;
 
       // Check if (was: is present in the subject
       PRInt32 wasOffset = subject.RFind(NS_LITERAL_STRING(" (was:"));
       bool strip = true;
 
       if (wasOffset >= 0) {
         // Check the number of references, to check if was: should be stripped