summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-13 15:22:36 -0400
committerJune McEnroe <june@causal.agency>2020-04-13 15:22:36 -0400
commit095cc3c2fe0a8bf6bc5191db8b92325cb131fe04 (patch)
tree9ab211f65d0a9d6effc23993be1812bb694f84b9
parentAdd <link> elements in Atom (diff)
downloadbubger-095cc3c2fe0a8bf6bc5191db8b92325cb131fe04.tar.gz
bubger-095cc3c2fe0a8bf6bc5191db8b92325cb131fe04.zip
Rename pathMangle to pathSafe
Mangle is a rude word.
-rw-r--r--archive.h6
-rw-r--r--atom.c4
-rw-r--r--html.c4
3 files changed, 7 insertions, 7 deletions
diff --git a/archive.h b/archive.h
index 749ab1b..7c6751d 100644
--- a/archive.h
+++ b/archive.h
@@ -149,7 +149,7 @@ static inline const char *pathUID(uint32_t uid, const char *type) {
 	return buf;
 }
 
-static inline const char *pathMangle(const char *messageID) {
+static inline const char *pathSafe(const char *messageID) {
 	if (!strchr(messageID, '/')) return messageID;
 	static char buf[PATH_MAX];
 	strlcpy(buf, messageID, sizeof(buf));
@@ -161,13 +161,13 @@ static inline const char *pathMangle(const char *messageID) {
 
 static inline const char *pathMessage(const char *messageID, const char *type) {
 	static char buf[PATH_MAX];
-	snprintf(buf, sizeof(buf), "message/%s.%s", pathMangle(messageID), type);
+	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];
-	snprintf(buf, sizeof(buf), "thread/%s.%s", pathMangle(messageID), type);
+	snprintf(buf, sizeof(buf), "thread/%s.%s", pathSafe(messageID), type);
 	return buf;
 }
 
diff --git a/atom.c b/atom.c
index 0572cab..1ed940a 100644
--- a/atom.c
+++ b/atom.c
@@ -51,7 +51,7 @@ static int atomAuthor(FILE *file, struct Address addr) {
 
 static char *atomEntryURL(const struct Envelope *envelope) {
 	struct Variable vars[] = {
-		{ "name", pathMangle(envelope->messageID) },
+		{ "name", pathSafe(envelope->messageID) },
 		{0},
 	};
 	return templateURL("/message/[name].mbox", vars);
@@ -99,7 +99,7 @@ int atomEntryClose(FILE *file) {
 
 static char *atomFeedURL(const struct Envelope *envelope, const char *type) {
 	struct Variable vars[] = {
-		{ "name", pathMangle(envelope->messageID) },
+		{ "name", pathSafe(envelope->messageID) },
 		{ "type", type },
 		{0},
 	};
diff --git a/html.c b/html.c
index 1d28541..d6bf723 100644
--- a/html.c
+++ b/html.c
@@ -79,7 +79,7 @@ int htmlMessageHead(FILE *file, const struct Envelope *envelope) {
 		{ "re", (strncmp(envelope->subject, "Re: ", 4) ? "Re: " : "") },
 		{ "subject", envelope->subject },
 		{ "messageID", envelope->messageID },
-		{ "pathID", pathMangle(envelope->messageID) },
+		{ "pathID", pathSafe(envelope->messageID) },
 		{0},
 	};
 	char *fragment = templateURL("#[messageID]", urlVars);
@@ -129,7 +129,7 @@ int htmlMessageTail(FILE *file) {
 
 int htmlThreadHead(FILE *file, const struct Envelope *envelope) {
 	struct Variable urlVars[] = {
-		{ "pathID", pathMangle(envelope->messageID) },
+		{ "pathID", pathSafe(envelope->messageID) },
 		{0},
 	};
 	char *path = templateURL("[pathID]", urlVars);