From 71d7aada572a6c2751d82f45869006c8a7be72c1 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 10 Apr 2020 17:42:19 -0400 Subject: Use hard links for single-message mbox threads --- concat.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/concat.c b/concat.c index eeab073..45ce12d 100644 --- a/concat.c +++ b/concat.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "archive.h" #include "imap.h" @@ -116,7 +117,12 @@ void concatData(struct List threads, struct List items) { path = threadPath(envelope.messageID, "mbox"); error = stat(path, &file); - if (error || file.st_mtime < uidNewest(flat, "mbox")) { + if (error && flat.len == 1) { + uint32_t uid = dataCheck(flat.ptr[0], Number).number; + error = link(uidPath(uid, "mbox"), path); + if (error) err(EX_CANTCREAT, "%s", path); + + } else if (error || file.st_mtime < uidNewest(flat, "mbox")) { FILE *mbox = fopen(path, "w"); if (!mbox) err(EX_CANTCREAT, "%s", path); -- cgit 1.4.1