From: Bertram Felgenhauer Date: Tue, 28 Apr 2009 12:18:33 +0000 (+0200) Subject: Drop References header if In-Reply-To is modified by user. Closes #3221. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e6b1986f20ef535bb7d2baabbbfad010af0dd5c;p=mutt Drop References header if In-Reply-To is modified by user. Closes #3221. --- diff --git a/doc/manual.xml.head b/doc/manual.xml.head index 616e7a3e..e684d0af 100644 --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -1387,7 +1387,7 @@ permanently. The selection can later be changed in the compose menu. When replying to messages, the In-Reply-To: header contains the -Message-Id of the message(s) you reply to. If you remove its value, Mutt will not generate a +Message-Id of the message(s) you reply to. If you remove or modify its value, Mutt will not generate a References: field, which allows you to create a new message thread, for example to create a new message to a mailing list without having to enter the mailing list's address. diff --git a/headers.c b/headers.c index 62a7c672..ac8bfac4 100644 --- a/headers.c +++ b/headers.c @@ -110,6 +110,15 @@ void mutt_edit_headers (const char *editor, safe_fclose (&ifp); mutt_unlink (path); + /* in case the user modifies/removes the In-Reply-To header with + $edit_headers set, we remove References: as they're likely invalid; + we can simply compare strings as we don't generate Refereces for + multiple Message-Ids in IRT anyways */ + if (!n->in_reply_to || (msg->env->in_reply_to && + mutt_strcmp (n->in_reply_to->data, + msg->env->in_reply_to->data) != 0)) + mutt_free_list (&msg->env->references); + /* restore old info. */ mutt_free_list (&n->references); n->references = msg->env->references; @@ -118,9 +127,6 @@ void mutt_edit_headers (const char *editor, mutt_free_envelope (&msg->env); msg->env = n; n = NULL; - if (!msg->env->in_reply_to) - mutt_free_list (&msg->env->references); - mutt_expand_aliases_env (msg->env); /* search through the user defined headers added to see if