summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertram Felgenhauer <int-e@gmx.de>2009-04-28 14:18:33 +0200
committerBertram Felgenhauer <int-e@gmx.de>2009-04-28 14:18:33 +0200
commit3e6b1986f20ef535bb7d2baabbbfad010af0dd5c (patch)
tree01892a6b852fe06ef782e0140e8a00bda062b914
parentf9ca2d43c64ff245b9dc595d1f0c311e6dc7cbe4 (diff)
Drop References header if In-Reply-To is modified by user. Closes #3221.
-rw-r--r--doc/manual.xml.head2
-rw-r--r--headers.c12
2 files changed, 10 insertions, 4 deletions
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.
<para>
When replying to messages, the <emphasis>In-Reply-To:</emphasis> 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
<emphasis>References:</emphasis> 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.
</para>
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