From 8f6d0a2c1c54542ec32a627054bfe1d015480c87 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 14 Apr 2020 11:07:33 -0400 Subject: Add decoding stubs --- parse.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index ff97789..d491e53 100644 --- a/parse.c +++ b/parse.c @@ -29,9 +29,7 @@ static struct Address parseAddress(struct List list) { } struct Address addr = {0}; if (list.ptr[0].type == String) { - // TODO: Decode UTF-8 in name. - addr.name = strdup(list.ptr[0].string); - if (!addr.name) err(EX_OSERR, "strdup"); + addr.name = decodeHeader(list.ptr[0].string); } if (list.ptr[2].type == String) addr.mailbox = list.ptr[2].string; if (list.ptr[3].type == String) addr.host = list.ptr[3].string; @@ -83,9 +81,9 @@ void parseEnvelope(struct Envelope *envelope, struct List list) { if (!date) errx(EX_PROTOCOL, "invalid envelope date format"); envelope->time = mktime(&time); - // TODO: Decode UTF-8 in subject. - envelope->subject = strdup(dataCheck(list.ptr[Subject], String).string); - if (!envelope->subject) err(EX_OSERR, "strdup"); + envelope->subject = decodeHeader( + dataCheck(list.ptr[Subject], String).string + ); for (size_t i = From; i <= Bcc; ++i) { if (list.ptr[i].type == List) continue; -- cgit 1.4.1