]> granicus.if.org Git - mutt/commitdiff
Make sure References and In-Reply-To headers are generated properly
authorThomas Roessler <roessler@does-not-exist.org>
Fri, 28 Dec 2001 17:19:00 +0000 (17:19 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Fri, 28 Dec 2001 17:19:00 +0000 (17:19 +0000)
when the user replies to one or more message-type attachments.

protos.h
recvcmd.c
send.c

index 9b7762de9dd0fe19877749cdc9e725546c1b379b..93fdaf3db3611c001727fdaef90cb3c0a5d08e7c 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -144,6 +144,7 @@ const char *mutt_make_version (void);
 const char *mutt_fqdn(short);
 
 void mutt_account_hook (const char* url);
+void mutt_add_to_reference_headers (ENVELOPE *env, ENVELOPE *curenv, LIST ***pp, LIST ***qq);
 void mutt_adv_mktemp (char *, size_t);
 void mutt_alias_menu (char *, size_t, ALIAS *);
 void mutt_allow_interrupt (int);
index 2efdfaddacae667c4d89883763aa42c52f5da127..2826898b996ad4afa08f8c25fe1b06afc3774b45 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -709,23 +709,17 @@ attach_reply_envelope_defaults (ENVELOPE *env, ATTACHPTR **idx, short idxlen,
   
   mutt_fix_reply_recipients (env);
   mutt_make_misc_reply_headers (env, Context, curhdr, curenv);
-  
+
   if (parent)
-    env->references = mutt_make_references (curenv);
+    mutt_add_to_reference_headers (env, curenv, NULL, NULL);
   else
   {
-    LIST **p;
-
-    env->references = NULL;
-    p = &env->references;
-
+    LIST **p = NULL, **q = NULL;
+    
     for (i = 0; i < idxlen; i++)
     {
       if (idx[i]->content->tagged)
-      {
-       while (*p) p = &(*p)->next;
-       *p = mutt_make_references (idx[i]->content->hdr->env);
-      }
+       mutt_add_to_reference_headers (env, idx[i]->content, &p, &q);
     }
   }
   
diff --git a/send.c b/send.c
index 4eac2c97c4664e5182445570b2c09f9c5b88d5a9..e6a4501e830b5e95b823dd0ca5dcc7ea789c3f21 100644 (file)
--- a/send.c
+++ b/send.c
@@ -599,46 +599,53 @@ void mutt_make_misc_reply_headers (ENVELOPE *env, CONTEXT *ctx,
   
 }
 
+void mutt_add_to_reference_headers (ENVELOPE *env, ENVELOPE *curenv, LIST ***pp, LIST ***qq)
+{
+  LIST **p = NULL, **q = NULL;
+
+  if (pp) p = *pp;
+  if (qq) q = *qq;
+  
+  if (!p) p = &env->references;
+  if (!q) q = &env->in_reply_to;
+  
+  while (*p) p = &(*p)->next;
+  while (*q) q = &(*q)->next;
+  
+  *p = mutt_make_references (curenv);
+  
+  if (curenv->message_id)
+  {
+    *q = mutt_new_list();
+    (*q)->data = safe_strdup (curenv->message_id);
+  }
+  
+  if (pp) *pp = p;
+  if (qq) *qq = q;
+  
+}
+
 static void 
 mutt_make_reference_headers (ENVELOPE *curenv, ENVELOPE *env, CONTEXT *ctx)
 {
-  HEADER *h;
-  LIST **p, **q;
-  int i;
+  env->references = NULL;
+  env->in_reply_to = NULL;
   
   if (!curenv)
   {
-    env->references = NULL;
-    env->in_reply_to = NULL;
-    p = &env->references;
-    q = &env->in_reply_to;
+    HEADER *h;
+    LIST **p = NULL, **q = NULL;
+    int i;
     
     for(i = 0; i < ctx->vcount; i++)
     {
-      while (*p) p = &(*p)->next;
-      while (*q) q = &(*q)->next;
-      
       h = ctx->hdrs[ctx->v2r[i]];
       if (h->tagged)
-      {
-       *p = mutt_make_references (h->env);
-       if (h->env->message_id)
-       {
-         *q = mutt_new_list ();
-         (*q)->data = safe_strdup (h->env->message_id);
-       }
-      }
+       mutt_add_to_reference_headers (env, h->env, &p, &q);
     }
   }
   else
-  {
-    env->references = mutt_make_references (curenv);
-    if (curenv->message_id)
-    {
-      env->in_reply_to = mutt_new_list ();
-      env->in_reply_to->data = safe_strdup (curenv->message_id);
-    }
-  }
+    mutt_add_to_reference_headers (env, curenv, NULL, NULL);
 }
 
 static int