🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #12858

References headers: a software solution

#12858
From: Tim Pierce
Date: Wed, 16 Nov 1994 18:40
203 lines
7369 bytes
[My apologies if you see this twice.  The first posting was
cancelled by a maniac site in the Netherlands.]

Note: this article is posted to news.admin.misc and
news.software.readers because it relates to a thread that
has occupied a great deal of traffic there.  It is also
posted to comp.mail.headers because it relates to the
treatment of various news and mail headers by MUAs, and to
comp.mail.list-admin.software because the issues being
discussed may have a drastic effect on mailing lists gated
to netnews.  I have set followups to "poster" because I do
not expect that this article will generate much followup
traffic, and I am certain that any such followups will not
be relevant to all four newsgroups; if you disagree and wish
to post a public response, please choose your newsgroups
carefully.

There is presently a war being waged in news.admin.misc and
news.software.readers over the treatment of References
headers by mail-to-news gateways.  Many gateways do not
generate References headers when posting to news a message
which is a response to another news article.  There is some
disagreement over whether this behavior is required by RFC
1036, but since the draft specification for news that may
soon replace 1036 does require this behavior, the debate is
heating up.

In response, I have written a short patch for Berkeley mail
that enables it to support References headers in a manner
compatible with netnews.  When a user replies to a message
with "r" or "R," this patch ensures that:

  * any References header from the parent message is copied
    to the new message, with the parent's Message-ID
    appended

  * if no References header in the parent is present, then a
    new one is generated containing the parent's Message-ID.

This is really a quick-and-dirty patch.  I would appreciate
hearing from anyone who applies it and finds that it does
not behave as advertised or expected, though I may not have
time to fix the problem quickly.

This patch was generated against the Berkeley mail source
found on gatekeeper.dec.com in /pub/BSD/net2/usr.bin/mail.
I assume, though am not certain, that source code found on
mirror sites will be identical.

---------- 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 ----------

-- 
Green Card fodder: Canter, Siegel, green card, Joel Furr, liable,
fortune, conspiracy, CyberSell, Tennessee Bar.
Technical Details
Message-ID: <1994Nov16.184022.12638@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!xlink.net!xlink100!snert!flatlin!subnet.sub.net!rz.uni-karlsruhe.de!news.uni-ulm.de!zib-berlin.de!uni-paderborn.de!urmel.informatik.rwth-aachen.de!rubb.rz.ruhr-uni-bochum.de!news.dfn.de!swiss.ans.net!howland.reston.ans.net!vixen.cso.uiuc.edu!uchinews!quads!twpierce

Show Full Headers
Complete Article Headers
Message-ID: <1994Nov16.184022.12638@midway.uchicago.edu>
Subject: References headers: a software solution
Date: Wed, 16 Nov 1994 18:40:22 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!xlink.net!xlink100!snert!flatlin!subnet.sub.net!rz.uni-karlsruhe.de!news.uni-ulm.de!zib-berlin.de!uni-paderborn.de!urmel.informatik.rwth-aachen.de!rubb.rz.ruhr-uni-bochum.de!news.dfn.de!swiss.ans.net!howland.reston.ans.net!vixen.cso.uiuc.edu!uchinews!quads!twpierce
Newsgroups: news.admin.misc,news.software.readers,comp.mail.list-admin.software,comp.mail.headers
Followup-To: poster
Sender: news@uchinews.uchicago.edu (News System)
Reply-To: twpierce@midway.uchicago.edu
Organization: alt.* cabal, Professor Emeritus
Lines: 202