diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-08-01 14:26:37 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-08-01 14:26:37 +0200 |
commit | 0ce958a22c82d45b4b0ce77dbcac2fd6f6822965 (patch) | |
tree | dbbde244734e396f1254557955af78173a3b1f2c | |
parent | 2aaa3cecd8a21c975c5bea886c678775627e90e7 (diff) | |
download | mblaze-0ce958a22c82d45b4b0ce77dbcac2fd6f6822965.tar.gz mblaze-0ce958a22c82d45b4b0ce77dbcac2fd6f6822965.tar.xz mblaze-0ce958a22c82d45b4b0ce77dbcac2fd6f6822965.zip |
mmime: only qp after newline when actually needed
-rw-r--r-- | mmime.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/mmime.c b/mmime.c index 5e25082..c46b0a5 100644 --- a/mmime.c +++ b/mmime.c @@ -245,13 +245,19 @@ print_header(char *line) { } if (s < e) { if (linelen + (e-s)+13 > 78) { - printf("\n"); - linelen = 0; + printf("\n "); + linelen = 1; + } + if (highbit || s[0] == ' ') { + printf("=?UTF-8?Q?"); + linelen += 13; + linelen += gen_qp((uint8_t *)s, e-s, 999, 1); + printf("?="); + } else { + fwrite(s, 1, e-s, stdout); + linelen += e-s; + prevq = 0; } - printf(" =?UTF-8?Q?"); - linelen += 13; - linelen += gen_qp((uint8_t *)s, e-s, 999, 1); - printf("?="); } prevq = 1; } else { |