From c5db1246fbafe62fc125f13664dd0e10204aa0b1 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 12 Apr 2020 16:43:08 -0400 Subject: Factor out path functions --- archive.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'archive.h') diff --git a/archive.h b/archive.h index 8fd9693..e9d4648 100644 --- a/archive.h +++ b/archive.h @@ -14,6 +14,9 @@ * along with this program. If not, see . */ +#include +#include +#include #include #include #include @@ -139,6 +142,26 @@ int templateRender( ); char *templateURL(const char *template, const struct Variable vars[]); +static inline char * +pathUID(char path[static PATH_MAX], uint32_t uid, const char *type) { + snprintf(path, PATH_MAX, "UID/%" PRIu32 ".%s", uid, type); + return path; +} + +static inline char *pathMessage( + char path[static PATH_MAX], const char *messageID, const char *type +) { + snprintf(path, PATH_MAX, "message/%s.%s", messageID, type); + return path; +} + +static inline char *pathThread( + char path[static PATH_MAX], const char *messageID, const char *type +) { + snprintf(path, PATH_MAX, "thread/%s.%s", messageID, type); + return path; +} + #define MBOX_HEADERS \ "Date Subject From Sender Reply-To To Cc Bcc " \ "Message-Id In-Reply-To References " \ -- cgit 1.4.1