From ef48616f2b63973830a07199c6bbe3b9a7ea6cc8 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Thu, 9 Apr 2020 18:55:16 -0400 Subject: Render basic HTML envelopes with templating --- archive.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'archive.c') 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); } -- cgit 1.4.1