diff options
author | Aron Griffis <agriffis@n01se.net> | 2008-07-10 09:38:25 -0400 |
---|---|---|
committer | Aron Griffis <agriffis@n01se.net> | 2008-07-10 09:38:25 -0400 |
commit | 18e36ad9759b35d64d8d9c67b9501c70fd40fa4c (patch) | |
tree | cadbff3ebb025fcb89e4127fb1732970578589f7 /copy.c | |
parent | 5a27978a5767a0174193cfc653d2e79a1145ad8e (diff) |
Fix three bugs handling flags in mutt_copy_header
1. mutt_copy_header incorrectly tests CH_UPDATE to determine whether to write
the In-Reply-To and References headers. CH_UPDATE refers only to Status: and
X-Status:
2. mutt_copy_header ignores CH_NOSTATUS which is supposed to indicate that the
mailbox type doesn't use those headers.
3. mutt_copy_header tests h->env->irt_changed and h->env->refs_changed when it
should be testing CH_UPDATE_IRT and CH_UPDATE_REFS, respectively. Early in
the function this happens:
if (h->env)
flags |= (h->env->irt_changed ? CH_UPDATE_IRT : 0)
| (h->env->refs_changed ? CH_UPDATE_REFS : 0);
This means that for most callers, the result is the same, but
mutt_copy_header should be testing the flags because the caller might have
set them explicitly without setting irt_changed/refs_changed.
Signed-off-by: Aron Griffis <agriffis@n01se.net>
Diffstat (limited to 'copy.c')
-rw-r--r-- | copy.c | 71 |
1 files changed, 34 insertions, 37 deletions
@@ -362,48 +362,45 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix) fputc('\n', out); } - if (flags & CH_UPDATE) + if ((flags & CH_UPDATE_IRT) && h->env->in_reply_to) { - if ((flags & CH_NOSTATUS) == 0) + LIST *listp = h->env->in_reply_to; + fputs ("In-Reply-To:", out); + for (; listp; listp = listp->next) { - if (h->env->irt_changed && h->env->in_reply_to) - { - LIST *listp = h->env->in_reply_to; - fputs ("In-Reply-To:", out); - for (; listp; listp = listp->next) - { - fputc (' ', out); - fputs (listp->data, out); - } - fputc ('\n', out); - } + fputc (' ', out); + fputs (listp->data, out); + } + fputc ('\n', out); + } - if (h->env->refs_changed && h->env->references) - { - fputs ("References:", out); - mutt_write_references (h->env->references, out, 0); - fputc ('\n', out); - } + if ((flags & CH_UPDATE_REFS) && h->env->references) + { + fputs ("References:", out); + mutt_write_references (h->env->references, out, 0); + fputc ('\n', out); + } - if (h->old || h->read) - { - fputs ("Status: ", out); - if (h->read) - fputs ("RO", out); - else if (h->old) - fputc ('O', out); - fputc ('\n', out); - } + if ((flags & CH_UPDATE) && (flags & CH_NOSTATUS) == 0) + { + if (h->old || h->read) + { + fputs ("Status: ", out); + if (h->read) + fputs ("RO", out); + else if (h->old) + fputc ('O', out); + fputc ('\n', out); + } - if (h->flagged || h->replied) - { - fputs ("X-Status: ", out); - if (h->replied) - fputc ('A', out); - if (h->flagged) - fputc ('F', out); - fputc ('\n', out); - } + if (h->flagged || h->replied) + { + fputs ("X-Status: ", out); + if (h->replied) + fputc ('A', out); + if (h->flagged) + fputc ('F', out); + fputc ('\n', out); } } |