summary refs log tree commit diff
path: root/archive.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--archive.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/archive.c b/archive.c
index 889f253..fd8ef53 100644
--- a/archive.c
+++ b/archive.c
@@ -240,16 +240,26 @@ static void exportMessage(struct List items) {
 	if (!header) errx(EX_PROTOCOL, "missing BODY[HEADER.FIELDS] data item");
 	if (!body) errx(EX_PROTOCOL, "missing BODY[TEXT] data item");
 
-	const char *path = uidPath(uid, "mbox");
-	FILE *file = fopen(path, "w");
-	if (!file) err(EX_CANTCREAT, "%s", path);
+	const char *path;
+	FILE *file;
+	int error;
 
-	int error = mboxFrom(file)
+	path = uidPath(uid, "mbox");
+	file = fopen(path, "w");
+	if (!file) err(EX_CANTCREAT, "%s", path);
+	error = mboxFrom(file)
 		|| mboxHeader(file, header)
 		|| mboxBody(file, body)
 		|| fclose(file);
 	if (error) err(EX_IOERR, "%s", path);
 
+	path = uidPath(uid, "html");
+	file = fopen(path, "w");
+	if (!file) err(EX_CANTCREAT, "%s", path);
+	error = htmlEnvelope(file, &envelope)
+		|| fclose(file);
+	if (error) err(EX_IOERR, "%s", path);
+
 	envelopeFree(envelope);
 }