summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--archive.c5
-rw-r--r--archive.h1
-rw-r--r--atom.c3
-rw-r--r--bubger.17
-rw-r--r--html.c12
5 files changed, 20 insertions, 8 deletions
diff --git a/archive.c b/archive.c
index 7aa6028..6a3f612 100644
--- a/archive.c
+++ b/archive.c
@@ -31,6 +31,7 @@
 
 const char *baseURL = "";
 const char *baseTitle;
+const char *baseAddress;
 
 static uint32_t uidRead(const char *path) {
 	FILE *file = fopen(path, "r");
@@ -65,7 +66,7 @@ int main(int argc, char *argv[]) {
 	const char *algo = "REFERENCES";
 	const char *search = "ALL";
 
-	for (int opt; 0 < (opt = getopt(argc, argv, "C:a:h:p:s:t:u:vw:"));) {
+	for (int opt; 0 < (opt = getopt(argc, argv, "C:a:h:m:p:s:t:u:vw:"));) {
 		switch (opt) {
 			break; case 'C': {
 				int error = chdir(optarg);
@@ -73,6 +74,7 @@ int main(int argc, char *argv[]) {
 			}
 			break; case 'a': algo = optarg;
 			break; case 'h': concatHead = optarg;
+			break; case 'm': baseAddress = optarg;
 			break; case 'p': port = optarg;
 			break; case 's': search = optarg;
 			break; case 't': baseTitle = optarg;
@@ -88,6 +90,7 @@ int main(int argc, char *argv[]) {
 	if (!host) errx(EX_USAGE, "host required");
 	if (!user) errx(EX_USAGE, "user required");
 	if (!baseTitle) baseTitle = mailbox;
+	if (!baseAddress) baseAddress = user;
 
 	char *pass = NULL;
 	if (passPath) {
diff --git a/archive.h b/archive.h
index 9a0de12..8cb20fe 100644
--- a/archive.h
+++ b/archive.h
@@ -190,6 +190,7 @@ int mboxBody(FILE *file, const char *body);
 
 extern const char *baseURL;
 extern const char *baseTitle;
+extern const char *baseAddress;
 
 int atomEntryOpen(FILE *file, const struct Envelope *envelope);
 int atomContent(FILE *file, const char *content);
diff --git a/atom.c b/atom.c
index 85393c9..ea58c49 100644
--- a/atom.c
+++ b/atom.c
@@ -158,7 +158,7 @@ int atomIndexOpen(FILE *file) {
 	const char *template = TEMPLATE(
 		<[q]xml version="1.0" encoding="utf-8"[q]>
 		<feed xmlns="http://www.w3.org/2005/Atom">
-		<id>[base]</id>
+		<id>mailto:[addr]</id>
 		<title>[title]</title>
 		<updated>[updated]</updated>
 		<link rel="self" href="[base]/index.atom"/>
@@ -169,6 +169,7 @@ int atomIndexOpen(FILE *file) {
 	strftime(updated, sizeof(updated), "%FT%TZ", gmtime(&now));
 	struct Variable vars[] = {
 		{ "q", "?" },
+		{ "addr", baseAddress },
 		{ "base", (baseURL ? baseURL : "") },
 		{ "title", baseTitle },
 		{ "updated", updated },
diff --git a/bubger.1 b/bubger.1
index ed402a1..9d3d729 100644
--- a/bubger.1
+++ b/bubger.1
@@ -1,4 +1,4 @@
-.Dd April 17, 2020
+.Dd April 26, 2020
 .Dt BUBGER 1
 .Os
 .
@@ -12,6 +12,7 @@
 .Op Fl C Ar path
 .Op Fl a Ar algo
 .Op Fl h Ar head
+.Op Fl m Ar addr
 .Op Fl p Ar port
 .Op Fl s Ar search
 .Op Fl t Ar title
@@ -52,6 +53,10 @@ to the
 .Sy <head>
 element of HTML pages.
 .
+.It Fl m Ar addr
+Set the mailto address for the archive.
+The default address is the username.
+.
 .It Fl p Ar port
 Connect to IMAP on
 .Ar port .
diff --git a/html.c b/html.c
index 5146a34..5acbdf2 100644
--- a/html.c
+++ b/html.c
@@ -69,7 +69,7 @@ htmlAddressList(FILE *file, const char *class, struct AddressList list) {
 	return templateRender(file, TEMPLATE(</ul>), NULL, NULL);
 }
 
-static char *htmlMailto(const struct Envelope *envelope) {
+static char *htmlReply(const struct Envelope *envelope) {
 	const char *template = {
 		"mailto:[mailbox]@[host]"
 		"?subject=[re][subject]"
@@ -142,19 +142,19 @@ int htmlMessageOpen(FILE *file, const struct Envelope *envelope) {
 		<header>
 			<h2 class="subject"><a href="[fragment]">[subject]</a></h2>
 			<address class="from">
-				<a href="[mailto]">[from]</a>
+				<a href="[reply]">[from]</a>
 			</address>
 			<time datetime="[utc]">[date]</time>
 	);
 	char *fragment = htmlFragment(envelope->messageID);
-	char *mailto = htmlMailto(envelope);
+	char *reply = htmlReply(envelope);
 	char utc[sizeof("0000-00-00T00:00:00Z")];
 	strftime(utc, sizeof(utc), "%FT%TZ", gmtime(&envelope->time));
 	struct Variable vars[] = {
 		{ "messageID", envelope->messageID },
 		{ "fragment", fragment },
 		{ "subject", envelope->subject },
-		{ "mailto", mailto },
+		{ "reply", reply },
 		{ "from", addressName(envelope->from) },
 		{ "utc", utc },
 		{ "date", envelope->date },
@@ -166,7 +166,7 @@ int htmlMessageOpen(FILE *file, const struct Envelope *envelope) {
 		|| htmlAddressList(file, "cc", envelope->cc)
 		|| htmlMessageNav(file, envelope)
 		|| templateRender(file, TEMPLATE(</header>), NULL, NULL);
-	free(mailto);
+	free(reply);
 	free(fragment);
 	return error;
 }
@@ -438,6 +438,7 @@ int htmlIndexOpen(FILE *file) {
 			<nav>
 				<ul>
 					<li><a href="index.atom">follow</a></li>
+					<li><a href="mailto:[addr]">write</a></li>
 				</ul>
 			</nav>
 		</header>
@@ -446,6 +447,7 @@ int htmlIndexOpen(FILE *file) {
 	);
 	struct Variable vars[] = {
 		{ "title", baseTitle },
+		{ "addr", baseAddress },
 		{0},
 	};
 	return templateRender(file, template, vars, escapeXML);
fc8f9b6422926f5b&follow=1'>Add The Awakened KingdomJune McEnroe A cute extra novella. Finally finished this series. 2020-09-12Move /opt/local back, cheat port select to use system manJune McEnroe This is not really how you're supposed to use the select system, I don't think, since the mandoc package actually creates those files, but it does work. This lets me actually use the git installed by MacPorts. 2020-09-12Move /opt/local behind /usr againJune McEnroe The reason I did this with pkgsrc was because I actually don't want the man(1) from mandoc, since it won't follow MANSECT. Same applies to MacPorts. I wish I could disable its man(1) with a variant or whatever. 2020-09-12Enable toc in cgit renderings of man pagesJune McEnroe But keep it disabled for READMEs since they always use non-standard sections and the TOC is just distracting there, I think. Also add the style so its h1 is the same size as the ones inside sections... 2020-09-11Install mandoc on macOSJune McEnroe 2020-09-11Rewrite install script yet againJune McEnroe 2020-09-11Remove NetBSD from install scriptJune McEnroe I never use it. 2020-09-11Use MacPorts rather than pkgsrcJune McEnroe My system is probably such a mess now... 2020-09-11Add debian VM name to sshJune McEnroe 2020-09-11Add influencer tweetJune McEnroe 2020-09-10Add The Kingdom of GodsJune McEnroe Reading has really slowed down :( 2020-09-07Add SunglassesJune McEnroe An IRC find. 2020-09-06Add Between the BreathsJune McEnroe One of those good songs from a soundtrack of a film that probably isn't? The summary sounds a lot more interesting than the title implies, at least. 2020-09-04Open /dev/tty in nudgeJune McEnroe This makes it work even when it's run connected to a pipe, i.e. as the notify command of catgirl... 2020-09-04Add nudgeJune McEnroe 2020-09-03Build fbclock with -lzJune McEnroe I guess this got lost somewhere, long ago... 2020-08-29Add tweets from retweetsJune McEnroe