Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Fix Mutt's draft handling for git imap-send
From 416eb783cf8b294f87f242ebfbf9aaa87a849763 Mon Sep 17 00:00:00 2001
Message-Id: <416eb783cf8b294f87f242ebfbf9aaa87a849763.1339836856.git.chris@arachsys.com>
From: Chris Webb <chris@arachsys.com>
Date: Sat, 16 Jun 2012 09:46:51 +0100
Subject: [PATCH] Fix draft handling for git imap-send
git format-patch generates a thread by setting Message-ID: on the first
message and References: & In-Reply-To: on subsequent messages. git imap-send
allows this thread to be appended to the Mutt drafts folder, ready to review,
edit and send. Unfortunately, Mutt strips Message-ID: when retrieving
postponed messages, so the thread ends up broken. It also fails to add the
configured Fcc: header to recalled messages.
We preserve the thread structure by not stripping Message-ID: when weed=0,
i.e. on recalling a postponed message, and ensure an Fcc: is added when
sending postponed messages if fcc is configured and the header is not already
set.
See http://dev.mutt.org/trac/ticket/3081 for the context.
Signed-off-by: Chris Webb <chris@arachsys.com>
---
postpone.c | 4 ++--
send.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/postpone.c b/postpone.c
index fa3ec64..13d2c14 100644
--- a/postpone.c
+++ b/postpone.c
@@ -547,8 +547,8 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr,
newhdr->content->length = hdr->content->length;
mutt_parse_part (fp, newhdr->content);
- FREE (&newhdr->env->message_id);
- FREE (&newhdr->env->mail_followup_to); /* really? */
+ if (weed)
+ FREE (&newhdr->env->message_id);
/* decrypt pgp/mime encoded messages */
diff --git a/send.c b/send.c
index bc000a7..63a4f8c 100644
--- a/send.c
+++ b/send.c
@@ -1504,7 +1504,7 @@ ci_send_message (int flags, /* send mode */
/* specify a default fcc. if we are in batchmode, only save a copy of
* the message if the value of $copy is yes or ask-yes */
- if (!fcc[0] && !(flags & (SENDPOSTPONED)) && (!(flags & SENDBATCH) || (quadoption (OPT_COPY) & 0x1)))
+ if (!fcc[0] && (!(flags & SENDBATCH) || (quadoption (OPT_COPY) & 0x1)))
{
/* set the default FCC */
if (!msg->env->from)
--
1.7.7.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment