summaryrefslogtreecommitdiffstats
path: root/copy.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2006-08-16 20:32:23 +0000
committerThomas Roessler <roessler@does-not-exist.org>2006-08-16 20:32:23 +0000
commitd894d447b97133ede1263aa186ca75f013bde579 (patch)
treec50bb0c399aff95bc65e1cbe9ca7bb16a77e42ce /copy.c
parentf744da4fd3e7dcc8efbf12a110583f7c3ffd8aa5 (diff)
Do intelligent things with long header lines.
Diffstat (limited to 'copy.c')
-rw-r--r--copy.c34
1 files changed, 8 insertions, 26 deletions
diff --git a/copy.c b/copy.c
index 16af8e8f..68cfcae1 100644
--- a/copy.c
+++ b/copy.c
@@ -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
{