From: Tim Chase Subject: Re: [patch] Adding In-Reply-To: support to mail(1) To: tech@openbsd.org Date: Tue, 21 Jan 2025 14:39:42 -0600 On 2024-02-02 07:57, Theo de Raadt wrote: > I would be happy to see improvements to mail(1), but past improvements > have tried to do too much in one go. The work must be in small > incremental steps, each on judged on their own. It is good that this > is finally getting split up into pieces. But I think the steps are > still too large. I don't want to pester too much, but I'm still hoping that this patch for adding In-Reply-To support for mail(1) could get reviewed and accepted. The aim was to avoid doing to many changes in one go (as requested), just adding the one piece of functionality. If there's something else that needs to be done, I'd be glad to try and remedy it. Thanks, -Tim diff --git a/cmd3.c b/cmd3.c index 3cf968e..c45c385 100644 --- a/cmd3.c +++ b/cmd3.c @@ -240,6 +240,7 @@ _respond(int *msgvec) head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; + head.h_inreplyto = skin(hfield("message-id", mp)); mail1(&head, 1); return(0); } @@ -620,6 +621,7 @@ _Respond(int *msgvec) head.h_from = NULL; head.h_cc = NULL; head.h_bcc = NULL; + head.h_inreplyto = skin(hfield("message-id", mp)); head.h_smopts = NULL; mail1(&head, 1); return(0); diff --git a/def.h b/def.h index 5df43a6..9cb6d80 100644 --- a/def.h +++ b/def.h @@ -173,6 +173,7 @@ struct header { struct name *h_to; /* Dynamic "To:" string */ char *h_from; /* User-specified "From:" string */ char *h_subject; /* Subject string */ + char *h_inreplyto; /* "In-Reply-To:" string */ struct name *h_cc; /* Carbon copies string */ struct name *h_bcc; /* Blind carbon copies */ struct name *h_smopts; /* Sendmail options */ diff --git a/send.c b/send.c index 9582675..caee618 100644 --- a/send.c +++ b/send.c @@ -288,6 +288,7 @@ mail(struct name *to, struct name *cc, struct name *bcc, struct name *smopts, head.h_subject = subject; head.h_cc = cc; head.h_bcc = bcc; + head.h_inreplyto = NULL; head.h_smopts = smopts; mail1(&head, 0); return(0); @@ -308,6 +309,7 @@ sendmail(void *v) head.h_subject = NULL; head.h_cc = NULL; head.h_bcc = NULL; + head.h_inreplyto = NULL; head.h_smopts = NULL; mail1(&head, 0); return(0); @@ -529,6 +531,8 @@ puthead(struct header *hp, FILE *fo, int w) fmt("Cc:", hp->h_cc, fo, w&GCOMMA), gotcha++; if (hp->h_bcc != NULL && w & GBCC) fmt("Bcc:", hp->h_bcc, fo, w&GCOMMA), gotcha++; + if (hp->h_inreplyto != NULL) + fprintf(fo, "In-Reply-To: <%s>\n", hp->h_inreplyto), gotcha++; if (gotcha && w & GNL) (void)putc('\n', fo); return(0); diff --git a/tty.c b/tty.c index 51f7ab7..4cba39a 100644 --- a/tty.c +++ b/tty.c @@ -144,6 +144,7 @@ grabh(struct header *hp, int gflags) goto out; hp->h_bcc = extract(s, GBCC); } + hp->h_inreplyto = NULL; error = 0; out: (void)sigaction(SIGTSTP, &savetstp, NULL);