From 5d2ea6d9d60a64579eb801a8e46ce7b65d1fbd1f Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 10 Apr 2020 11:33:04 -0400 Subject: Link mbox files into message/ --- export.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'export.c') diff --git a/export.c b/export.c index 3e87521..b1f63b8 100644 --- a/export.c +++ b/export.c @@ -34,6 +34,12 @@ static const char *uidPath(uint32_t uid, const char *type) { return buf; } +static const char *messagePath(const char *messageID, const char *type) { + static char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "message/%s.%s", messageID, type); + return buf; +} + static void flatten(struct List *flat, struct List nested) { for (size_t i = 0; i < nested.len; ++i) { if (nested.ptr[i].type == List) { @@ -253,6 +259,10 @@ void exportData(struct List items) { || fclose(file); if (error) err(EX_IOERR, "%s", path); + const char *dest = messagePath(envelope.messageID, "mbox"); + error = link(path, dest); + if (error) err(EX_CANTCREAT, "%s", dest); + path = uidPath(uid, "html"); file = fopen(path, "w"); if (!file) err(EX_CANTCREAT, "%s", path); -- cgit 1.4.1