diff options
| author | Sam Varshavchik | 2013-08-25 22:32:09 -0400 |
|---|---|---|
| committer | Sam Varshavchik | 2013-08-28 21:07:40 -0400 |
| commit | 88fcede4132f42e2297d11832cf6c7e047c71ce8 (patch) | |
| tree | 84bab46506b26bc351e4df753e0f20719401c2cf /rfc2045 | |
| parent | 064186c841dee4f58e9ef3577e7550fbc761ab48 (diff) | |
| download | courier-libs-88fcede4132f42e2297d11832cf6c7e047c71ce8.tar.bz2 | |
rfc2045_decodemsgtoutf8 (reformime -u): fold headers
Diffstat (limited to 'rfc2045')
| -rw-r--r-- | rfc2045/rfc2045decodemsgtoutf8.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/rfc2045/rfc2045decodemsgtoutf8.c b/rfc2045/rfc2045decodemsgtoutf8.c index e3c5fe8..bca243a 100644 --- a/rfc2045/rfc2045decodemsgtoutf8.c +++ b/rfc2045/rfc2045decodemsgtoutf8.c @@ -29,6 +29,30 @@ static void doconvtoutf8_write(const char *p, size_t n, (p, n, ptr->callback->arg); } +static void doconvtoutf8_write_noeol(const char *p, size_t n, + void *void_arg) +{ + while (n) + { + size_t i; + + if (*p == '\n') + { + doconvtoutf8_write(" ", 1, void_arg); + ++p; + --n; + continue; + } + + for (i=0; i<n; ++i) + if (p[i] == '\n') + break; + doconvtoutf8_write(p, i, void_arg); + p += i; + n -= i; + } +} + static void doconvtoutf8_error(const char *p, int n, void *void_arg) { @@ -56,7 +80,7 @@ static int doconvtoutf8_rfc822hdr(const char *header, doconvtoutf8_write(": ", 2, &info); } rfc822_display_hdrvalue(header, value, "utf-8", - doconvtoutf8_write, + doconvtoutf8_write_noeol, doconvtoutf8_error, &info); doconvtoutf8_write("\n", 1, &info); |
