Github messages for mblaze
 help / color / mirror / Atom feed
* [PR PATCH] mgenmid: add option -d for custom domain
@ 2021-05-31  7:46 nothien
  2021-06-02 21:01 ` leahneukirchen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: nothien @ 2021-05-31  7:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

There is a new pull request by nothien against master on the mblaze repository

https://github.com/nothien/mblaze master
https://github.com/leahneukirchen/mblaze/pull/209

mgenmid: add option -d for custom domain
In my setup, I use mblaze across multiple mailboxes, each with different addresses and domains, which they provide through mailbox-local configuration files.  I needed this option in order to select the domain programmatically.

A patch file from https://github.com/leahneukirchen/mblaze/pull/209.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-209.patch --]
[-- Type: text/x-diff, Size: 1777 bytes --]

From 1fa062532f0e42bacdcb9d243295ab89609e0845 Mon Sep 17 00:00:00 2001
From: Arav K <nothien@uber.space>
Date: Mon, 31 May 2021 08:26:27 +0100
Subject: [PATCH 1/2] mgenmid: add option -d for custom domain

---
 mgenmid.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/mgenmid.c b/mgenmid.c
index 56499c8..b31eddb 100644
--- a/mgenmid.c
+++ b/mgenmid.c
@@ -29,17 +29,26 @@ printb36(uint64_t x)
 	fputs(o, stdout);
 }
 
-int main()
+int main(int argc, char *argv[])
 {
 	char hostbuf[1024];
 	char *host = 0;
 
+	int c;
+	while ((c = getopt(argc, argv, "d:")) != -1)
+		switch (c) {
+		case 'd': host = optarg; break;
+		default:
+			  fprintf(stderr, "Usage: mgenmid [-d domain]\n");
+			  exit(1);
+		}
+
 	char *f = blaze822_home_file("profile");
 	struct message *config = blaze822(f);
 
 	xpledge("stdio rpath dns", "");
 
-	if (config) // try FQDN: first
+	if (!host && config) // try FQDN:
 		host = blaze822_hdr(config, "fqdn");
 
 	if (!host && gethostname(hostbuf, sizeof hostbuf) == 0) {

From 25e04ed31801df5e9c74919918f3ece5775e34c8 Mon Sep 17 00:00:00 2001
From: Arav K <nothien@uber.space>
Date: Mon, 31 May 2021 08:39:57 +0100
Subject: [PATCH 2/2] mgenmid: document -d option on man page

---
 man/mgenmid.1 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/man/mgenmid.1 b/man/mgenmid.1
index ad1abc2..4aaa5d0 100644
--- a/man/mgenmid.1
+++ b/man/mgenmid.1
@@ -6,6 +6,7 @@
 .Nd generate a Message-ID
 .Sh SYNOPSIS
 .Nm
+[-d domain]
 .Sh DESCRIPTION
 .Nm
 generates and prints a unique Message-ID.
@@ -16,6 +17,10 @@ and a fully qualified domain name.
 The fully qualified domain name is arrived at by:
 .Bl -enum
 .It
+Using the
+.Sq Li domain
+parameter provided on the command line.
+.It
 Using
 .Sq Li FQDN\&:
 from

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mgenmid: add option -d for custom domain
  2021-05-31  7:46 [PR PATCH] mgenmid: add option -d for custom domain nothien
@ 2021-06-02 21:01 ` leahneukirchen
  2021-06-02 21:13 ` nothien
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: leahneukirchen @ 2021-06-02 21:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/209#issuecomment-853379771

Comment:
If you use multiple mblaze profiles, you can set `fqdn:` there.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mgenmid: add option -d for custom domain
  2021-05-31  7:46 [PR PATCH] mgenmid: add option -d for custom domain nothien
  2021-06-02 21:01 ` leahneukirchen
@ 2021-06-02 21:13 ` nothien
  2021-06-04 15:04 ` leahneukirchen
  2021-06-05  9:40 ` nothien
  3 siblings, 0 replies; 5+ messages in thread
From: nothien @ 2021-06-02 21:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

New comment by nothien on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/209#issuecomment-853386557

Comment:
Yes, but that means I need a `.mblaze` directory which contains the profile for every local mailbox like this; it's wasteful, and I essentially end up writing a wrapper script for `mgenmid` which deals with it properly.

Regardless, I'm using this patch locally; I've provided it here for the sake of doing so, and if it doesn't seem useful, feel free to close it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mgenmid: add option -d for custom domain
  2021-05-31  7:46 [PR PATCH] mgenmid: add option -d for custom domain nothien
  2021-06-02 21:01 ` leahneukirchen
  2021-06-02 21:13 ` nothien
@ 2021-06-04 15:04 ` leahneukirchen
  2021-06-05  9:40 ` nothien
  3 siblings, 0 replies; 5+ messages in thread
From: leahneukirchen @ 2021-06-04 15:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/209#issuecomment-854798288

Comment:
I think it would make more sense to use, say, an environment variable `$MBLAZE_FQDN` if it is set. Then you can set it before calling mcom etc.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mgenmid: add option -d for custom domain
  2021-05-31  7:46 [PR PATCH] mgenmid: add option -d for custom domain nothien
                   ` (2 preceding siblings ...)
  2021-06-04 15:04 ` leahneukirchen
@ 2021-06-05  9:40 ` nothien
  3 siblings, 0 replies; 5+ messages in thread
From: nothien @ 2021-06-05  9:40 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 250 bytes --]

New comment by nothien on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/209#issuecomment-855213602

Comment:
But such a design will lead to environment variables for every profile setting.  I don't think that's a good idea either.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-05  9:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31  7:46 [PR PATCH] mgenmid: add option -d for custom domain nothien
2021-06-02 21:01 ` leahneukirchen
2021-06-02 21:13 ` nothien
2021-06-04 15:04 ` leahneukirchen
2021-06-05  9:40 ` nothien

Github messages for mblaze

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/mblaze-github

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 mblaze-github mblaze-github/ https://inbox.vuxu.org/mblaze-github \
		mblaze-github@inbox.vuxu.org
	public-inbox-index mblaze-github

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.github.mblaze


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git