about summary refs log tree commit diff
path: root/archive.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-09 18:55:16 -0400
committerJune McEnroe <june@causal.agency>2020-04-09 18:55:16 -0400
commitef48616f2b63973830a07199c6bbe3b9a7ea6cc8 (patch)
tree7d92c7dc3560d75469e72e33f1f69dfc2089dcf1 /archive.h
parentTrim angle brackets from message IDs (diff)
downloadbubger-ef48616f2b63973830a07199c6bbe3b9a7ea6cc8.tar.gz
bubger-ef48616f2b63973830a07199c6bbe3b9a7ea6cc8.zip
Render basic HTML envelopes with templating
Diffstat (limited to 'archive.h')
-rw-r--r--archive.h17
1 files changed, 17 insertions, 0 deletions
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 <https://www.gnu.org/licenses/>.
  */
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
 
@@ -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);