changeset: 6779:a9757cff92da
user: Kevin McCarthy <[email protected]>
date: Sat Sep 03 16:19:38 2016 -0700
link: http://dev.mutt.org/hg/mutt/rev/a9757cff92da
Preserve message-id and mft headers for recalled messages. (closes #3081)
Git patch creates a patch series mailbox, including the Message-ID.
Using this as draft files was removing the Message-ID, and thus
breaking the threaded structure.
The second part of the ticket has already been addressed by
95a2230ef889 (for ticket 3653).
Thanks to Chris Webb for the original patch.
diffs (45 lines):
diff -r 7a53de8c9251 -r a9757cff92da postpone.c
--- a/postpone.c Fri Sep 02 19:33:35 2016 -0700
+++ b/postpone.c Sat Sep 03 16:19:38 2016 -0700
@@ -535,9 +535,17 @@
}
-
+/* args:
+ * fp If not NULL, file containing the template
+ * ctx If fp is NULL, the context containing the header with the
template
+ * newhdr The template is read into this HEADER
+ * hdr The message to recall/resend
+ * resend Set if resending (as opposed to recalling a postponed msg).
+ * Resent messages enable header weeding, and also
+ * discard any existing Message-ID and Mail-Followup-To.
+ */
int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr,
- short weed)
+ short resend)
{
MESSAGE *msg = NULL;
char file[_POSIX_PATH_MAX];
@@ -560,15 +568,16 @@
fseeko (fp, hdr->offset, 0);
newhdr->offset = hdr->offset;
- newhdr->env = mutt_read_rfc822_header (fp, newhdr, 1, weed);
+ /* enable header weeding for resent messages */
+ newhdr->env = mutt_read_rfc822_header (fp, newhdr, 1, resend);
newhdr->content->length = hdr->content->length;
mutt_parse_part (fp, newhdr->content);
- /* If message_id is set, then we are resending a message and don't want
- * message_id or mail_followup_to. Otherwise, we are resuming a
- * postponed message, and want to keep the mail_followup_to.
+ /* If resending a message, don't keep message_id or mail_followup_to.
+ * Otherwise, we are resuming a postponed message, and want to keep those
+ * headers if they exist.
*/
- if (newhdr->env->message_id != NULL)
+ if (resend)
{
FREE (&newhdr->env->message_id);
FREE (&newhdr->env->mail_followup_to);