From: Thomas Roessler Date: Fri, 28 Dec 2001 17:19:00 +0000 (+0000) Subject: Make sure References and In-Reply-To headers are generated properly X-Git-Tag: mutt-1-3-25-rel~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02b407421834ee6c903e9c0bc4284e499b11a12b;p=mutt Make sure References and In-Reply-To headers are generated properly when the user replies to one or more message-type attachments. --- diff --git a/protos.h b/protos.h index 9b7762de..93fdaf3d 100644 --- 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); diff --git a/recvcmd.c b/recvcmd.c index 2efdfadd..2826898b 100644 --- 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 4eac2c97..e6a4501e 100644 --- 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