about summary refs log tree commit diff
path: root/archive.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-12 16:43:08 -0400
committerJune McEnroe <june@causal.agency>2020-04-12 16:43:08 -0400
commitc5db1246fbafe62fc125f13664dd0e10204aa0b1 (patch)
treeb05e2bc24a392a61e07b9d8594ea2c17f821de5e /archive.h
parentAvoid mutating header/body for mbox output (diff)
downloadbubger-c5db1246fbafe62fc125f13664dd0e10204aa0b1.tar.gz
bubger-c5db1246fbafe62fc125f13664dd0e10204aa0b1.zip
Factor out path functions
Diffstat (limited to '')
-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 " \
odesJune McEnroe 2021-06-18Document channel keys in join optionJune McEnroe 2021-06-18Use | to separate flags from config optionsJune McEnroe 2021-06-18Stop referring to server-time as IRCv3.2June McEnroe 2021-06-17Add mailing list archive to READMEJune McEnroe 2021-06-10Stop accumulating ISUPPORT tokens once MOTD startsJune McEnroe 2021-06-09Use seprintf for snip, removing strlcpynJune McEnroe 2021-06-09Use seprintf for reserializeJune McEnroe 2021-06-09Use seprintf for capListJune McEnroe 2021-06-09Add seprintfJune McEnroe 2021-05-27Add pounce-notify to README 2.4June McEnroe 2021-05-27Fix ENVIRONMENT formatting in pounce-notify(1)June McEnroe 2021-05-27Add note about Libera.Chat SASL-only rangesJune McEnroe 2021-05-25Add QUIRKS fileJune McEnroe 2021-05-19Replace freenode with tilde.chatJune McEnroe 2021-05-04notify: Reword pounce-notify manualJune McEnroe 2021-05-02Clean up Makefiles, configure scriptsJune McEnroe 2021-04-30palaver: Exit on getopt failureJune McEnroe 2021-04-30notify: Implement pounce-notifyJune McEnroe