about summary refs log tree commit diff
path: root/export.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-16 20:03:12 -0400
committerJune McEnroe <june@causal.agency>2020-04-16 20:03:12 -0400
commit6b0d631a171192d4d9d5ccc6acabb307fee5fa22 (patch)
tree1d406ef9428199bdd56c7a5dcd26bb0d90cd9fab /export.c
parentDecode Q encoding (diff)
downloadbubger-6b0d631a171192d4d9d5ccc6acabb307fee5fa22.tar.gz
bubger-6b0d631a171192d4d9d5ccc6acabb307fee5fa22.zip
Decode quoted-printable and 7bit/8bit
Diffstat (limited to '')
-rw-r--r--export.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/export.c b/export.c
index 1e07acd..ed594de 100644
--- a/export.c
+++ b/export.c
@@ -99,12 +99,10 @@ static void exportAtom(
 		}
 	}
 	if (bodyPartType(part, "text", "plain")) {
-		const char *content = dataCheck(body, String).string;
-		error = 0
-			|| atomContentOpen(file)
-			|| decodeContent(file, escapeXML, structure, content)
-			|| atomContentClose(file);
+		char *content = decodeToString(part, dataCheck(body, String).string);
+		error = atomContent(file, content);
 		if (error) err(EX_IOERR, "%s", path);
+		free(content);
 	}
 
 	error = atomEntryClose(file) || fclose(file);
@@ -135,11 +133,11 @@ static int exportHTMLBody(
 			|| htmlMessageClose(file);
 	} 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);
+		char *content = decodeToString(
+			structure, dataCheck(body, String).string
+		);
+		error = htmlInline(file, structure, content);
+		free(content);
 	}
 	return error;
 }