Index | Thread | Search

From:
Tim Chase <openbsd@tim.thechases.com>
Subject:
Re: [patch] Adding In-Reply-To: support to mail(1)
To:
tech@openbsd.org
Cc:
Steffen Nurpmeso <steffen@sdaoden.eu>
Date:
Thu, 1 Feb 2024 11:39:01 -0600

Download raw body.

Thread
  • Steffen Nurpmeso:

    [patch] Adding In-Reply-To: support to mail(1)

  • On 2024-02-01 17:46, Steffen Nurpmeso wrote:
    > Tim Chase wrote in
    >  |I noticed that mail(1) doesn't seem to support adding In-Reply-To:
    >  ...
    >  |I'm not quite certain whether those
    >  |
    >  |  head.h_inreplyto = hfield("message-id", mp);
    >  |
    >  |lines should be
    >  |
    >  |  head.h_inreplyto = skin(hfield("message-id", mp));
    > 
    > It should definetely be skin()ned.
    
    Thanks for the feedback/insight!
    
    Okay, I've updated the patch to skin the incoming message-id and...
    
    > But when writing out the header you need to place this "msg-id" in
    > standard terms in <angle-brackets>.
    
    ...also included the message-ID in angle brackets.
    
    > The BSD Mail codebase is older than the standard.
    > It is a total looser regarding anything such, and works only by
    > accident.  And not truly exaggerating.
    
    A spot disappointing that it doesn't get more love since the very
    first thing you see on a successful install is instructions to
    invoke mail(1)
    
      CONGRATULATIONS! Your OpenBSD install has been successfully completed!
    
      When you login to your new system the first time, please read your mail
      using the 'mail' command.
    
    (the fact your post came via s-nail gave me s smile in the context
    of a thread on mail(1) being used)
    
    > You should also manage References:.
    
    At this point, my hope was to just bring the functionality up to
    parity with FreeBSD's mail(1) which does provide In-Reply-To
    functionality so other MUAs have a fighting chance of proper
    threading.
    
    -tkc
    
    
    
    
    
    ------------------->8---------------------
    
    diff --git a/def.h b/def.h
    index 5df43a6..2dfc656 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/cmd3.c b/cmd3.c
    index 3cf968e..7b23c14 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/send.c b/send.c
    index 9582675..fa9028f 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..e1ec61f 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);
    
  • Steffen Nurpmeso:

    [patch] Adding In-Reply-To: support to mail(1)