From 3b0ea6d60f1d22802301b4db7fc67813563c5276 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 21 Apr 2020 12:18:25 -0400 Subject: Add parent links to message nav --- html.c | 49 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 13 deletions(-) (limited to 'html.c') diff --git a/html.c b/html.c index b0e00c2..62376d5 100644 --- a/html.c +++ b/html.c @@ -84,23 +84,53 @@ static char *htmlMailto(const struct Envelope *envelope) { return templateURL(template, vars); } -static char *htmlFragment(const struct Envelope *envelope) { +static char *htmlFragment(const char *messageID) { struct Variable vars[] = { - { "messageID", envelope->messageID }, + { "messageID", messageID }, {0}, }; return templateURL("#[messageID]", vars); } -static char *htmlMbox(const struct Envelope *envelope) { +static char *htmlMbox(const char *messageID) { struct Variable vars[] = { - { "messageID", envelope->messageID }, + { "messageID", messageID }, { "type", "mbox" }, {0}, }; return templateURL("../" PATH_MESSAGE, vars); } +int htmlMessageNav(FILE *file, const struct Envelope *envelope) { + int error = templateRender(file, TEMPLATE(), NULL, NULL); +} + int htmlMessageOpen(FILE *file, const struct Envelope *envelope) { // TODO: Conditionally include mailto: link. const char *template = TEMPLATE( @@ -111,15 +141,9 @@ int htmlMessageOpen(FILE *file, const struct Envelope *envelope) { [from] - ); - char *fragment = htmlFragment(envelope); + char *fragment = htmlFragment(envelope->messageID); char *mailto = htmlMailto(envelope); - char *mbox = htmlMbox(envelope); char utc[sizeof("0000-00-00T00:00:00Z")]; strftime(utc, sizeof(utc), "%FT%TZ", gmtime(&envelope->time)); struct Variable vars[] = { @@ -130,17 +154,16 @@ int htmlMessageOpen(FILE *file, const struct Envelope *envelope) { { "from", addressName(envelope->from) }, { "utc", utc }, { "date", envelope->date }, - { "mbox", mbox }, {0}, }; int error = 0 || templateRender(file, template, vars, escapeXML) + || htmlMessageNav(file, envelope) || htmlAddressList(file, "to", envelope->to) || htmlAddressList(file, "cc", envelope->cc) || templateRender(file, TEMPLATE(), NULL, NULL); free(mailto); free(fragment); - free(mbox); return error; } -- cgit 1.4.1