summary refs log tree commit diff
path: root/archive.h
diff options
context:
space:
mode:
Diffstat (limited to 'archive.h')
-rw-r--r--archive.h23
1 files changed, 23 insertions, 0 deletions
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 <https://www.gnu.org/licenses/>.
  */
 
+#include <inttypes.h>
+#include <limits.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
@@ -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 " \