1 changeset: 5945:5f590adfdf1a
3 user: Rocco Rutte <pdmef@gmx.net>
4 date: Thu Jun 25 17:31:27 2009 +0200
5 summary: header folding: treat From_ specially, never wrap on sending side
9 @@ -1630,9 +1630,9 @@ static int fold_one_header (FILE *fp, co
10 dprint(4,(debugfile,"mwoh: pfx=[%s], tag=[%s], flags=%d value=[%s]\n",
11 pfx, tag, flags, value));
13 - if (fprintf (fp, "%s%s: ", NONULL (pfx), tag) < 0)
14 + if (tag && *tag && fprintf (fp, "%s%s: ", NONULL (pfx), tag) < 0)
16 - col = mutt_strlen (tag) + 2 + mutt_strlen (pfx);
17 + col = mutt_strlen (tag) + (tag && *tag ? 2 : 0) + mutt_strlen (pfx);
21 @@ -1717,9 +1717,12 @@ static int write_one_header (FILE *fp, i
24 char *tagbuf, *valbuf, *t;
25 + int is_from = ((end - start) > 5 &&
26 + ascii_strncasecmp (start, "from ", 5) == 0);
28 - /* only pass through folding machinery if necessary for sending */
29 - if (!(flags & CH_DISPLAY) && pfxw + max <= wraplen)
30 + /* only pass through folding machinery if necessary for sending,
31 + never wrap From_ headers on sending */
32 + if (!(flags & CH_DISPLAY) && (pfxw + max <= wraplen || is_from))
34 valbuf = mutt_substrdup (start, end);
35 dprint(4,(debugfile,"mwoh: buf[%s%s] short enough, "
36 @@ -1738,8 +1741,16 @@ static int write_one_header (FILE *fp, i
39 t = strchr (start, ':');
40 - tagbuf = mutt_substrdup (start, t);
41 - valbuf = mutt_substrdup (t + 2, end);
45 + valbuf = mutt_substrdup (start, end);
49 + tagbuf = mutt_substrdup (start, t);
50 + valbuf = mutt_substrdup (t + 2, end);
52 dprint(4,(debugfile,"mwoh: buf[%s%s] too long, "
53 "max width = %d > %dn",
54 NONULL(pfx), valbuf, max, wraplen));