summary refs log tree commit diff
path: root/archive.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--archive.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/archive.h b/archive.h
index d0bc00d..06fd435 100644
--- a/archive.h
+++ b/archive.h
@@ -156,15 +156,19 @@ char *decodeHeader(const char *header);
 char *decodeToString(const struct BodyPart *part, const char *content);
 int decodeToFile(FILE *file, const struct BodyPart *part, const char *content);
 
+struct Attachment {
+	char path[3][NAME_MAX + 1];
+};
+
 static inline const char *pathUID(uint32_t uid, const char *type) {
-	static char buf[PATH_MAX];
+	static char buf[PATH_MAX + 1];
 	snprintf(buf, sizeof(buf), "UID/%" PRIu32 ".%s", uid, type);
 	return buf;
 }
 
 static inline const char *pathSafe(const char *messageID) {
 	if (!strchr(messageID, '/')) return messageID;
-	static char buf[PATH_MAX];
+	static char buf[NAME_MAX + 1];
 	strlcpy(buf, messageID, sizeof(buf));
 	for (char *ptr = buf; (ptr = strchr(ptr, '/')); ++ptr) {
 		*ptr = ';';
@@ -173,13 +177,13 @@ static inline const char *pathSafe(const char *messageID) {
 }
 
 static inline const char *pathMessage(const char *messageID, const char *type) {
-	static char buf[PATH_MAX];
+	static char buf[PATH_MAX + 1];
 	snprintf(buf, sizeof(buf), "message/%s.%s", pathSafe(messageID), type);
 	return buf;
 }
 
 static inline const char *pathThread(const char *messageID, const char *type) {
-	static char buf[PATH_MAX];
+	static char buf[PATH_MAX + 1];
 	snprintf(buf, sizeof(buf), "thread/%s.%s", pathSafe(messageID), type);
 	return buf;
 }
@@ -203,6 +207,9 @@ int atomFeedClose(FILE *file);
 extern const char *htmlTitle;
 int htmlMessageOpen(FILE *file, const struct Envelope *envelope);
 int htmlInline(FILE *file, const struct BodyPart *part, const char *content);
+int htmlAttachment(
+	FILE *file, const struct BodyPart *part, const struct Attachment *attach
+);
 int htmlMessageClose(FILE *file);
 int htmlThreadHead(FILE *file, const struct Envelope *envelope);
 int htmlThreadOpen(FILE *file, const struct Envelope *envelope);