Bug 1279869 - Keep message id when editing a draft. r=mkmelin
authorJorg K
Fri, 17 Jun 2016 14:57:48 +0200
changeset 25273 516a17742688a2ae370ea6931c5fef4217892d99
parent 25272 604bda922be6e54af41213e297cc274dfc7bb893
child 25274 209456d7f0f099985a19208fe39055fb8a1abed2
push id1725
push userclokep@gmail.com
push dateMon, 19 Sep 2016 17:35:08 +0000
treeherdercomm-beta@6ead1abf3817 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1279869
Bug 1279869 - Keep message id when editing a draft. r=mkmelin
mailnews/mime/src/mimedrft.cpp
--- a/mailnews/mime/src/mimedrft.cpp
+++ b/mailnews/mime/src/mimedrft.cpp
@@ -1237,24 +1237,31 @@ mime_parse_stream_complete (nsMIMESessio
 
 
     CreateCompositionFields( from, repl, to, cc, bcc, fcc, grps, foll,
       org, subj, refs, priority, news_host,
       mdd->mailcharset,
       getter_AddRefs(fields));
 
     draftInfo = MimeHeaders_get(mdd->headers, HEADER_X_MOZILLA_DRAFT_INFO, false, false);
+
+    // Keep the same message id when editing a draft unless we're
+    // editing a message "as new message" (template) or forwarding inline.
+    if (mdd->format_out != nsMimeOutput::nsMimeMessageEditorTemplate &&
+        fields && !forward_inline) {
+      fields->SetMessageId(id);
+    }
+
     if (draftInfo && fields && !forward_inline)
     {
       char *parm = 0;
       parm = MimeHeaders_get_parameter(draftInfo, "vcard", NULL, NULL);
       fields->SetAttachVCard(parm && !strcmp(parm, "1"));
+      PR_FREEIF(parm);
 
-      fields->SetMessageId(id); // keep same message id for editing template.
-      PR_FREEIF(parm);
       parm = MimeHeaders_get_parameter(draftInfo, "receipt", NULL, NULL);
       if (parm && !strcmp(parm, "0"))
         fields->SetReturnReceipt(false);
       else
       {
         int receiptType = 0;
         fields->SetReturnReceipt(true);
         sscanf(parm, "%d", &receiptType);