From 43f68d46baede7e91aa5d061a06112b74f3ac609 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Thu, 16 Apr 2020 10:44:35 -0400 Subject: Render text/plain to HTML --- export.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'export.c') diff --git a/export.c b/export.c index 3c6a31f..1e07acd 100644 --- a/export.c +++ b/export.c @@ -115,7 +115,7 @@ static int exportHTMLBody( FILE *file, struct List *section, const struct BodyPart *structure, struct Data body ) { - int error; + int error = 0; if (structure->multipart) { // TODO: Choose a part from multipart/alternative. for (size_t i = 0; i < structure->parts.len; ++i) { @@ -133,9 +133,13 @@ static int exportHTMLBody( || htmlMessageOpen(file, structure->message.envelope) || exportHTMLBody(file, section, structure->message.structure, body) || htmlMessageClose(file); - } else { - // TODO: Content. - error = 0; + } else if (bodyPartType(structure, "text", "plain")) { + // TODO: Check if not inline. + const char *content = dataCheck(body, String).string; + error = 0 + || htmlInlineOpen(file, structure) + || decodeContent(file, escapeXML, structure, content) + || htmlInlineClose(file); } return error; } -- cgit 1.4.1