From 27ce93d8778ccf68c8b436454213e6f6fe826a38 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 12 Apr 2020 21:56:44 -0400 Subject: Concatenate HTML threads --- html.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) (limited to 'html.c') diff --git a/html.c b/html.c index de64ed8..e92ab0a 100644 --- a/html.c +++ b/html.c @@ -79,6 +79,7 @@ int htmlMessageHead(FILE *file, const struct Envelope *envelope) { { "re", (strncmp(envelope->subject, "Re: ", 4) ? "Re: " : "") }, { "subject", envelope->subject }, { "messageID", envelope->messageID }, + { "pathID", pathMangle(envelope->messageID) }, {0}, }; char *fragment = templateURL("#[messageID]", urlVars); @@ -86,7 +87,7 @@ int htmlMessageHead(FILE *file, const struct Envelope *envelope) { "mailto:[mailbox]@[host]?subject=[re][subject]&In-Reply-To=[messageID]", urlVars ); - char *mbox = templateURL("../message/[messageID].mbox", urlVars); + char *mbox = templateURL("../message/[pathID].mbox", urlVars); char date[256]; char utc[sizeof("0000-00-00T00:00:00Z")]; @@ -127,3 +128,59 @@ int htmlMessageTail(FILE *file) { int n = fprintf(file, "\n"); return (n < 0 ? n : 0); } + +int htmlThreadHead(FILE *file, const struct Envelope *envelope) { + struct Variable urlVars[] = { + { "pathID", pathMangle(envelope->messageID) }, + {0}, + }; + char *path = templateURL("[pathID]", urlVars); + + struct Variable vars[] = { + { "subject", envelope->subject }, + { "path", path }, + {0}, + }; + const char *Head = TEMPLATE( + + + [subject] + + + + ); + int error = templateRender(file, Head, vars, escapeXML); + free(path); + return error; +} + +int htmlThreadHeader(FILE *file, const struct Envelope *envelope) { + struct Variable vars[] = { + { "subject", envelope->subject }, + {0}, + }; + const char *Header = TEMPLATE( +

[subject]

+ ); + return templateRender(file, Header, vars, escapeXML); +} + +int htmlThreadOpen(FILE *file) { + int n = fprintf(file, TEMPLATE(
)); + return (n < 0 ? n : 0); +} + +int htmlThreadClose(FILE *file) { + int n = fprintf(file, TEMPLATE(
)); + return (n < 0 ? n : 0); +} + +int htmlThreadTail(FILE *file) { + return 0; +} -- cgit 1.4.1