aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-01-21 17:40:52 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-01-21 17:40:52 +0100
commitcf36745b0c46b1203778ddc40b537905ff3a5d03 (patch)
treeb940774d65b2d07889714cf62ade1f1069681d72
parent225e5787bf4e8bc155174588e6ee5d2e2eeb2692 (diff)
downloadmblaze-cf36745b0c46b1203778ddc40b537905ff3a5d03.tar.gz
mscan: fmt_from: first decode RFC2047, then parse address
-rw-r--r--mscan.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/mscan.c b/mscan.c
index 39115c5..2a2c543 100644
--- 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 *