backout fix for 307023 because it caused regressions like 465586, problems forwarding messages inline, editing drafts, r/sr = Standard8
authorDavid Bienvenu <bienvenu@nventure.com>
Tue, 25 Nov 2008 09:00:37 -0800
changeset 1217 a1c7621565a6a1cb1ded52c3a937566bc5efa49a
parent 1216 9da34e2932d1ea92f3c225a22180190f6dacb5ed
child 1218 30012575b88654f2760fbb3f24d422d7756c2989
push idunknown
push userunknown
push dateunknown
bugs307023, 465586
backout fix for 307023 because it caused regressions like 465586, problems forwarding messages inline, editing drafts, r/sr = Standard8
mailnews/mime/src/mimedrft.cpp
--- a/mailnews/mime/src/mimedrft.cpp
+++ b/mailnews/mime/src/mimedrft.cpp
@@ -1724,16 +1724,17 @@ nsresult
 mime_decompose_file_init_fn ( void *stream_closure, MimeHeaders *headers )
 {
   struct mime_draft_data *mdd = (struct mime_draft_data *) stream_closure;
   nsMsgAttachedFile *attachments = 0, *newAttachment = 0;
   int nAttachments = 0;
   //char *hdr_value = NULL;
   char *parm_value = NULL;
   PRBool needURL = PR_FALSE;
+  PRBool creatingMsgBody = PR_TRUE;
   PRBool bodyPart = PR_FALSE;
 
   NS_ASSERTION (mdd && headers, "null mime draft data and/or headers");
   if (!mdd || !headers)
     return -1;
 
   if (mdd->options->decompose_init_count)
   {
@@ -1769,16 +1770,17 @@ mime_decompose_file_init_fn ( void *stre
       }
     }
 
     mdd->messageBody = PR_NEWZAP (nsMsgAttachedFile);
     NS_ASSERTION (mdd->messageBody, "missing messageBody in mime_decompose_file_init_fn");
     if (!mdd->messageBody)
       return MIME_OUT_OF_MEMORY;
     newAttachment = mdd->messageBody;
+    creatingMsgBody = PR_TRUE;
     bodyPart = PR_TRUE;
   }
   else
   {
     /* always allocate one more extra; don't ask me why */
     needURL = PR_TRUE;
     if ( nAttachments )
     {
@@ -1908,18 +1910,19 @@ mime_decompose_file_init_fn ( void *stre
   mdd->tmpFile = do_QueryInterface(tmpFile);
 
   newAttachment->tmp_file = mdd->tmpFile;
 
   rv = NS_NewLocalFileOutputStream(getter_AddRefs(mdd->tmpFileStream), tmpFile,PR_WRONLY | PR_CREATE_FILE, 00600);
   if (NS_FAILED(rv))
     return MIME_UNABLE_TO_OPEN_TMP_FILE;
 
-  // body parts will already be decoded, I believe, so don't decode them twice.
-  if (!bodyPart)
+  // For now, we are always going to decode all of the attachments
+  // for the message. This way, we have native data
+  if (creatingMsgBody)
   {
     MimeDecoderData *(*fn) (nsresult (*) (const char*, PRInt32, void*), void*) = 0;
 
     //
     // Initialize a decoder if necessary.
     //
     if (!newAttachment->encoding)
       ;