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.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'archive.h') diff --git a/archive.h b/archive.h index d804021..8d96878 100644 --- a/archive.h +++ b/archive.h @@ -14,6 +14,7 @@ * along with this program. If not, see . */ +#include #include #include @@ -56,6 +57,20 @@ static inline void envelopeFree(struct Envelope envelope) { free(envelope.bcc.addrs); } +#define TEMPLATE(...) #__VA_ARGS__ + +struct Variable { + const char *name; + const char *value; +}; + +typedef int EscapeFn(FILE *file, const char *str); + +int templateRender( + FILE *file, const char *template, + const struct Variable *vars, EscapeFn *escape +); + #define MBOX_HEADERS \ "Date Subject From Sender Reply-To To Cc Bcc " \ "Message-Id In-Reply-To References " \ @@ -64,3 +79,5 @@ static inline void envelopeFree(struct Envelope envelope) { int mboxFrom(FILE *file); int mboxHeader(FILE *file, char *header); int mboxBody(FILE *file, char *body); + +int htmlEnvelope(FILE *file, const struct Envelope *envelope); -- cgit 1.4.1