Download raw body.
[patch] Adding In-Reply-To: support to mail(1)
I noticed that mail(1) doesn't seem to support adding In-Reply-To:
headers which ended up messing up some mail workflows here. Would
there be any interest in the patch below to add support? (applied
in /usr/src/usr.bin/mail)
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));
The FreeBSD mail(1) source uses the skin() version, but the comment
on skin() in the OpenBSD source-tree talks about addresses, not
message-IDs.
I'm also not positive about setting h_inreplyto in the grabh()
function. It might be overly-aggressive and need to be filtered
based on the gflags parameter.
-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; /* Optional 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 = 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 = 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);
[patch] Adding In-Reply-To: support to mail(1)