Article View: news.software.readers
Article #12694References headers and software solutions
From: Tim Pierce
Date: Sat, 12 Nov 1994 10:01
Date: Sat, 12 Nov 1994 10:01
189 lines
6837 bytes
6837 bytes
Background: there is presently a war being waged in
news.admin.misc and news.software.readers over the validity
of news articles produced by mail-to-news gateways which
cannot construct proper References headers for those
articles.
This message is being posted to comp.mail.headers and
comp.mail.list-admin.software for probably obvious reasons;
it is being posted also to news.admin.misc and
news.software.readers because those newsgroups have already
borne the brunt of this discussion. Followups have been set
to "poster" because I do not this message to provoke a new
public discussion; if you disagree and wish to post a public
response, please trim the Newsgroups line carefully.
I have written a quick-and-dirty patch to Berkeley mail,
enclosed below, which causes "mail" to maintain References
headers in a rudimentary manner. Here, when composing a
response, any existing References header will be copied into
the new message with the parent's Message-ID appended. If
no References header already exists, a new one containing
the parent's Message-ID is generated.
I have tested the patches only briefly, but they appear to
work. I would appreciate feedback from anyone wishing to
test them more thoroughly, or from anyone who wishes to
suggest a better way to make these changes. If time
permits, I shall attempt to write and submit similar patches
for other mail agents.
This patch was generated against the source code at
gatekeeper.dec.com:/pub/BSD/net2/usr.bin/mail. I assume
that mirror sites provide identical or nearly identical
code.
--------------- cut here ---------------
diff -c mail-old/cmd3.c mail/cmd3.c
*** mail-old/cmd3.c Sat Nov 12 02:17:33 1994
--- mail/cmd3.c Sat Nov 12 03:39:51 1994
***************
*** 193,199 ****
int *msgvec;
{
struct message *mp;
! char *cp, *rcv, *replyto;
char **ap;
struct name *np;
struct header head;
--- 193,199 ----
int *msgvec;
{
struct message *mp;
! char *cp, *rcv, *replyto, *refs, *msgid;
char **ap;
struct name *np;
struct header head;
***************
*** 244,249 ****
--- 244,257 ----
head.h_cc = NIL;
head.h_bcc = NIL;
head.h_smopts = NIL;
+ msgid = hfield("message-id", mp);
+ if ((refs = hfield("references", mp)) == NOSTR) {
+ head.h_refs = msgid;
+ } else {
+ head.h_refs = malloc (strlen(refs) + strlen(msgid) + 2);
+ sprintf (head.h_refs, "%s %s", refs, msgid);
+ }
+
mail1(&head, 1);
return(0);
}
***************
*** 583,588 ****
--- 591,597 ----
struct message *mp;
register int *ap;
register char *cp;
+ char *refs, *msgid;
head.h_to = NIL;
for (ap = msgvec; *ap != 0; ap++) {
***************
*** 602,607 ****
--- 611,623 ----
head.h_cc = NIL;
head.h_bcc = NIL;
head.h_smopts = NIL;
+ msgid = hfield("message-id", mp);
+ if ((refs = hfield("references", mp)) == NOSTR) {
+ head.h_refs = msgid;
+ } else {
+ head.h_refs = malloc (strlen(refs) + strlen(msgid) + 2);
+ sprintf (head.h_refs, "%s %s", refs, msgid);
+ }
mail1(&head, 1);
return 0;
}
diff -c mail-old/def.h mail/def.h
*** mail-old/def.h Sat Nov 12 02:17:34 1994
--- mail/def.h Sat Nov 12 03:44:26 1994
***************
*** 45,50 ****
--- 45,51 ----
* Mail -- a mail program
*
* Author: Kurt Shoens (UCB) March 25, 1978
+ * References hacks by Tim Pierce (UChicago) November 12, 1994
*/
#define APPEND /* New mail goes to end of mailbox */
***************
*** 151,157 ****
#define GSUBJECT 2 /* Likewise, Subject: line */
#define GCC 4 /* And the Cc: line */
#define GBCC 8 /* And also the Bcc: line */
! #define GMASK (GTO|GSUBJECT|GCC|GBCC)
/* Mask of places from whence */
#define GNL 16 /* Print blank line after */
--- 152,159 ----
#define GSUBJECT 2 /* Likewise, Subject: line */
#define GCC 4 /* And the Cc: line */
#define GBCC 8 /* And also the Bcc: line */
! #define GREFS 16 /* Plus the References: line */
! #define GMASK (GTO|GSUBJECT|GCC|GBCC|GREFS)
/* Mask of places from whence */
#define GNL 16 /* Print blank line after */
***************
*** 169,174 ****
--- 171,177 ----
struct name *h_cc; /* Carbon copies string */
struct name *h_bcc; /* Blind carbon copies */
struct name *h_smopts; /* Sendmail options */
+ char *h_refs; /* References header */
};
/*
diff -c mail-old/send.c mail/send.c
*** mail-old/send.c Sat Nov 12 02:17:34 1994
--- mail/send.c Sat Nov 12 03:22:42 1994
***************
*** 277,282 ****
--- 277,283 ----
head.h_cc = NIL;
head.h_bcc = NIL;
head.h_smopts = NIL;
+ head.h_refs = NOSTR;
mail1(&head, 0);
return(0);
}
***************
*** 438,444 ****
return(fi);
}
(void) rm(tempMail);
! (void) puthead(hp, nfo, GTO|GSUBJECT|GCC|GBCC|GNL|GCOMMA);
c = getc(fi);
while (c != EOF) {
(void) putc(c, nfo);
--- 439,445 ----
return(fi);
}
(void) rm(tempMail);
! (void) puthead(hp, nfo, GTO|GSUBJECT|GCC|GBCC|GREFS|GNL|GCOMMA);
c = getc(fi);
while (c != EOF) {
(void) putc(c, nfo);
***************
*** 482,487 ****
--- 483,490 ----
fmt("Cc:", hp->h_cc, fo, w&GCOMMA), gotcha++;
if (hp->h_bcc != NIL && w & GBCC)
fmt("Bcc:", hp->h_bcc, fo, w&GCOMMA), gotcha++;
+ if (hp->h_refs != NOSTR && w & GREFS)
+ fprintf(fo, "References: %s\n", hp->h_refs), gotcha++;
if (gotcha && w & GNL)
(void) putc('\n', fo);
return(0);
--------------- cut here ---------------
--
"A person who dies of lung cancer at age 70 will not be hospitalized later
with another disease," said a study released Thursday by [Canada's] Imperial
Tobacco touting the benefits of early death in smokers on the health-care
system. (Reuters, in the Chicago _Tribune_, 9/3/94)
Technical Details
Message-ID:
<1994Nov12.100115.27964@midway.uchicago.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.mail.headers.mbox.zip!nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!swrinde!gatech!ncar!uchinews!quads!twpierceShow Full Headers
Complete Article Headers
Message-ID: <1994Nov12.100115.27964@midway.uchicago.edu> Subject: References headers and software solutions Date: Sat, 12 Nov 1994 10:01:15 GMT From: twpierce@quads.uchicago.edu (Tim Pierce) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.mail.headers.mbox.zip!nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!swrinde!gatech!ncar!uchinews!quads!twpierce Newsgroups: comp.mail.headers,comp.mail.list-admin.software,news.admin.misc,news.software.readers Followup-To: poster Sender: news@uchinews.uchicago.edu (News System) Supersedes: <1994Nov12.095022.27389@midway.uchicago.edu> Reply-To: twpierce@midway.uchicago.edu Organization: alt.* cabal, Professor Emeritus Lines: 188