diff options
author | June McEnroe <june@causal.agency> | 2020-04-09 18:55:16 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-04-09 18:55:16 -0400 |
commit | ef48616f2b63973830a07199c6bbe3b9a7ea6cc8 (patch) | |
tree | 7d92c7dc3560d75469e72e33f1f69dfc2089dcf1 /archive.c | |
parent | Trim angle brackets from message IDs (diff) | |
download | bubger-ef48616f2b63973830a07199c6bbe3b9a7ea6cc8.tar.gz bubger-ef48616f2b63973830a07199c6bbe3b9a7ea6cc8.zip |
Render basic HTML envelopes with templating
Diffstat (limited to '')
-rw-r--r-- | archive.c | 18 |
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); } |