about summary refs log tree commit diff
path: root/export.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-16 10:44:35 -0400
committerJune McEnroe <june@causal.agency>2020-04-16 10:44:35 -0400
commit43f68d46baede7e91aa5d061a06112b74f3ac609 (patch)
tree40cfff80ed4e57673a2ed3e6cb6656cd4d25aa10 /export.c
parentRender message links before to/cc (diff)
downloadbubger-43f68d46baede7e91aa5d061a06112b74f3ac609.tar.gz
bubger-43f68d46baede7e91aa5d061a06112b74f3ac609.zip
Render text/plain to HTML
Diffstat (limited to '')
-rw-r--r--export.c12
1 files changed, 8 insertions, 4 deletions
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;
 }