mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit cf36745b0c46b1203778ddc40b537905ff3a5d03
parent 225e5787bf4e8bc155174588e6ee5d2e2eeb2692
Author: Leah Neukirchen <leah@vuxu.org>
Date:   Sat, 21 Jan 2017 17:40:52 +0100

mscan: fmt_from: first decode RFC2047, then parse address

Diffstat:
mscan.c | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/mscan.c b/mscan.c @@ -191,21 +191,24 @@ fmt_subject(struct message *msg, char *file, int strip) static char * fmt_from(struct message *msg) { - static char fromdec[64]; + static char fromdec[256]; char *from = "(unknown)"; - char to[256]; char *v, *w; if (!msg) return ""; if ((v = blaze822_hdr(msg, "from"))) { - if (itsme(v) && ((w = blaze822_hdr(msg, "to")))) { - snprintf(to, sizeof to, "TO:%s", w); - from = to; + blaze822_decode_rfc2047(fromdec, v, sizeof fromdec - 1, "UTF-8"); + fromdec[sizeof fromdec - 1] = 0; + from = fromdec; + + if (itsme(fromdec) && ((w = blaze822_hdr(msg, "to")))) { + snprintf(fromdec, sizeof fromdec, "TO:%s", w); + from = fromdec; } else { char *disp, *addr; - blaze822_addr(v, &disp, &addr); + blaze822_addr(fromdec, &disp, &addr); if (disp) from = disp; else if (addr) @@ -213,10 +216,7 @@ fmt_from(struct message *msg) } } - blaze822_decode_rfc2047(fromdec, from, sizeof fromdec - 1, "UTF-8"); - fromdec[sizeof fromdec - 1] = 0; - - return fromdec; + return from; } static char *