diff options
Diffstat (limited to 'copy.c')
-rw-r--r-- | copy.c | 34 |
1 files changed, 8 insertions, 26 deletions
@@ -39,6 +39,7 @@ static int copy_delete_attach (BODY *b, FILE *fpin, FILE *fpout, char *date); /* Ok, the only reason for not merging this with mutt_copy_header() * below is to avoid creating a HEADER structure in message_handler(). + * Also, this one will wrap headers much more aggressively than the other one. */ int mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, @@ -275,34 +276,15 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, /* We couldn't do the prefixing when reading because RFC 2047 * decoding may have concatenated lines. */ - if (flags & CH_PREFIX) + + if (flags & (CH_DECODE|CH_PREFIX)) { - char *ch = headers[x]; - int print_prefix = 1; - - while (*ch) - { - if (print_prefix) - { - if (fputs (prefix, out) == EOF) - { - error = TRUE; - break; - } - print_prefix = 0; - } - - if (*ch == '\n' && ch[1]) - print_prefix = 1; - - if (putc (*ch++, out) == EOF) - { - error = TRUE; - break; - } - } - if (error) + if (mutt_write_one_header (out, 0, headers[x], + flags & CH_PREFIX ? prefix : 0) == -1) + { + error = TRUE; break; + } } else { |