🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
2 messages
2 total messages Started by Tim Pierce Wed, 16 Nov 1994 18:40
References headers: a software solution
#12858
Author: 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.
Re: References headers: a software solution
#12892
Author: Karl_Kleinpaste
Date: Thu, 17 Nov 1994 18:22
262 lines
11701 bytes
Following Tim Pierce's lead, below is a patch to GNU Emacs 19.27's
rnewspost.el and sendmail.el modules.  There are 3 particular purposes
to these patches, but the important one at hand is that they provide
the generation of Usenet-compliant References: headers for mailed
replies.  I use GNUS as my unified news-and-mail interface, so these
address my needs completely; related patches may be indicated for
RMAIL and VM, but I wouldn't know personally.

Just as the US Supreme Court observed that the solution to bad speech
is more speech, the solution to non-compliant software is enhanced
software.  We shouldn't be arguing over how to deal with poorly-
formatted mail replies with which gateways have trouble; we should be
seeing to it that proper formatting is done.

(Other things done with this patch: Provides ^C^F^O in the *mail*
buffer as a way to get at the "optional CC list," a simple means to
include the original To/Cc people in a reply's Cc, useful when you see
mail in a quasi-newsgroup and want to "reply to all"; and an ability
to define your own "sendmail -f" address via the user-mail-addr variable.)

cheers,
--karl
________________

*** /afs/cs.cmu.edu/misc/gnu-emacs/common-depot/19.27/lib/emacs/19.27/lisp/rnewspost.el	Mon Aug 24 21:57:37 1992
--- rnewspost.el	Thu Nov 17 13:10:34 1994
***************
*** 201,211 ****
  	;; the fcc: and bcc: fields
  	(let ((mail-self-blind nil)
  	      (mail-archive-file-name nil))
! 	  (mail-setup to subject in-reply-to nil replybuffer nil)
  	  (beginning-of-line)
  	  (delete-region (point) (progn (forward-line 1) (point)))
  	  (goto-char (point-max)))
!       (mail-setup to subject in-reply-to nil replybuffer nil))
      ;;;(mail-position-on-field "Posting-Front-End")
      ;;;(insert (emacs-version))
      (goto-char (point-max))
--- 201,211 ----
  	;; the fcc: and bcc: fields
  	(let ((mail-self-blind nil)
  	      (mail-archive-file-name nil))
! 	  (mail-setup to subject nil nil replybuffer nil nil)
  	  (beginning-of-line)
  	  (delete-region (point) (progn (forward-line 1) (point)))
  	  (goto-char (point-max)))
!       (mail-setup to subject nil nil replybuffer nil nil))
      ;;;(mail-position-on-field "Posting-Front-End")
      ;;;(insert (emacs-version))
      (goto-char (point-max))
***************
*** 269,275 ****
        (setq from (mail-fetch-field "from")
  	    subject (mail-fetch-field "subject")
  	    reply-to (mail-fetch-field "reply-to")
! 	    date (mail-fetch-field "date"))
        (setq to from)
        (pop-to-buffer "*mail*")
        (mail nil
--- 269,285 ----
        (setq from (mail-fetch-field "from")
  	    subject (mail-fetch-field "subject")
  	    reply-to (mail-fetch-field "reply-to")
! 	    date (mail-fetch-field "date")
! 	    message-id (mail-fetch-field "message-id")
! 	    orig-to (mail-fetch-field "to")
! 	    orig-cc (mail-fetch-field "cc"))
!       (setq optional-cc (cond ((and orig-to orig-cc)
! 			       (concat orig-to ",\n\t" orig-cc))
! 			      ((and orig-to (not orig-cc))
! 			       orig-to)
! 			      ((and (not orig-to) orig-cc)
! 			       orig-cc)
! 			      (t nil)))
        (setq to from)
        (pop-to-buffer "*mail*")
        (mail nil
***************
*** 278,286 ****
  	    (let ((stop-pos (string-match "  *at \\|  *@ \\| *(\\| *<" from)))
  	      (concat (if stop-pos (substring from 0 stop-pos) from)
  		      "'s message of "
! 		      date))
  	    nil
! 	   buffer))))
  
  ;@@ the guts of news-reply and news-post-news should be combined. -tower
  (defun news-reply ()
--- 288,296 ----
  	    (let ((stop-pos (string-match "  *at \\|  *@ \\| *(\\| *<" from)))
  	      (concat (if stop-pos (substring from 0 stop-pos) from)
  		      "'s message of "
! 		      date " " message-id "\nReferences: " message-id))
  	    nil
! 	   buffer nil optional-cc))))
  
  ;@@ the guts of news-reply and news-post-news should be combined. -tower
  (defun news-reply ()
*** /afs/cs.cmu.edu/misc/gnu-emacs/common-depot/19.27/lib/emacs/19.27/lisp/sendmail.el	Mon Aug  8 19:22:31 1994
--- sendmail.el	Thu Nov 17 12:56:40 1994
***************
*** 121,126 ****
--- 121,127 ----
  (defvar mail-reply-buffer nil)
  (defvar mail-send-actions nil
    "A list of actions to be performed upon successful sending of a message.")
+ (defvar mail-optional-cc-list nil)
  
  (defvar mail-default-headers nil
    "*A string containing header lines, to be inserted in outgoing messages.
***************
*** 158,164 ****
  (defvar mail-send-hook nil
    "Normal hook run before sending mail, in Mail mode.")
  
! (defun mail-setup (to subject in-reply-to cc replybuffer actions)
    (if (eq mail-aliases t)
        (progn
  	(setq mail-aliases nil)
--- 159,165 ----
  (defvar mail-send-hook nil
    "Normal hook run before sending mail, in Mail mode.")
  
! (defun mail-setup (to subject in-reply-to cc replybuffer actions optional-cc)
    (if (eq mail-aliases t)
        (progn
  	(setq mail-aliases nil)
***************
*** 166,171 ****
--- 167,173 ----
  	    (build-mail-aliases))))
    (setq mail-send-actions actions)
    (setq mail-reply-buffer replybuffer)
+   (setq mail-optional-cc-list optional-cc)
    (goto-char (point-min))
    (insert "To: ")
    (save-excursion
***************
*** 219,225 ****
  C-c C-f  move to a header field (and create it if there isn't):
  	 C-c C-f C-t  move to To:	C-c C-f C-s  move to Subj:
  	 C-c C-f C-b  move to BCC:	C-c C-f C-c  move to CC:
! 	 C-c C-f C-f  move to FCC:
  C-c C-t  move to message text.
  C-c C-y  mail-yank-original (insert current message, in Rmail).
  C-c C-q  mail-fill-yanked-message (fill what was yanked).
--- 221,227 ----
  C-c C-f  move to a header field (and create it if there isn't):
  	 C-c C-f C-t  move to To:	C-c C-f C-s  move to Subj:
  	 C-c C-f C-b  move to BCC:	C-c C-f C-c  move to CC:
! 	 C-c C-f C-f  move to FCC:	C-c C-f C-o  fill in auto CC:
  C-c C-t  move to message text.
  C-c C-y  mail-yank-original (insert current message, in Rmail).
  C-c C-q  mail-fill-yanked-message (fill what was yanked).
***************
*** 256,261 ****
--- 258,264 ----
    (define-key mail-mode-map "\C-c\C-f\C-f" 'mail-fcc)
    (define-key mail-mode-map "\C-c\C-f\C-c" 'mail-cc)
    (define-key mail-mode-map "\C-c\C-f\C-s" 'mail-subject)
+   (define-key mail-mode-map "\C-c\C-f\C-o" 'mail-optional-cc)
    (define-key mail-mode-map "\C-c\C-t" 'mail-text)
    (define-key mail-mode-map "\C-c\C-y" 'mail-yank-original)
    (define-key mail-mode-map "\C-c\C-q" 'mail-fill-yanked-message)
***************
*** 466,472 ****
  			       nil errbuf nil "-oi")
  			 ;; Always specify who from,
  			 ;; since some systems have broken sendmails.
! 			 (list "-f" (user-login-name))
  ;;;			 ;; Don't say "from root" if running under su.
  ;;;			 (and (equal (user-real-login-name) "root")
  ;;;			      (list "-f" (user-login-name)))
--- 469,477 ----
  			       nil errbuf nil "-oi")
  			 ;; Always specify who from,
  			 ;; since some systems have broken sendmails.
! 			 (list "-f" (if (boundp 'user-mail-addr)
! 					user-mail-addr
! 				      (user-login-name)))
  ;;;			 ;; Don't say "from root" if running under su.
  ;;;			 (and (equal (user-real-login-name) "root")
  ;;;			      (list "-f" (user-login-name)))
***************
*** 648,653 ****
--- 653,670 ----
        (mail-position-on-field "to"))
    (insert "\nFCC: " folder))
  
+ (defun mail-optional-cc ()
+   "Insert mail-optional-cc-list at end of CC-field."
+   (interactive)
+   (if mail-optional-cc-list
+       (save-excursion
+ 	(expand-abbrev)
+ 	(or (mail-position-on-field "cc" t)
+ 	    (progn (mail-position-on-field "to")
+ 		   (insert "\nCC: ")))
+ 	(insert mail-optional-cc-list))
+     (message "There is no optional CC list.")))
+ 
  (defun mail-position-on-field (field &optional soft)
    (let (end
  	(case-fold-search t))
***************
*** 767,773 ****
  ;; Put these last, to reduce chance of lossage from quitting in middle of loading the file.
  
  ;;;###autoload
! (defun mail (&optional noerase to subject in-reply-to cc replybuffer actions)
    "Edit a message to be sent.  Prefix arg means resume editing (don't erase).
  When this function returns, the buffer `*mail*' is selected.
  The value is t if the message was newly initialized; otherwise, nil.
--- 784,790 ----
  ;; Put these last, to reduce chance of lossage from quitting in middle of loading the file.
  
  ;;;###autoload
! (defun mail (&optional noerase to subject in-reply-to cc replybuffer actions optional-cc)
    "Edit a message to be sent.  Prefix arg means resume editing (don't erase).
  When this function returns, the buffer `*mail*' is selected.
  The value is t if the message was newly initialized; otherwise, nil.
***************
*** 803,809 ****
  The seventh argument ACTIONS is a list of actions to take
   if/when the message is sent.  Each action looks like (FUNCTION . ARGS);
   when the message is sent, we apply FUNCTION to ARGS.
!  This is how Rmail arranges to mark messages `answered'."
    (interactive "P")
  ;;; This is commented out because I found it was confusing in practice.
  ;;; It is easy enough to rename *mail* by hand with rename-buffer
--- 820,829 ----
  The seventh argument ACTIONS is a list of actions to take
   if/when the message is sent.  Each action looks like (FUNCTION . ARGS);
   when the message is sent, we apply FUNCTION to ARGS.
!  This is how Rmail arranges to mark messages `answered'.
! The eighth argument OPTIONAL-CC is a set of recipients who are
!  not initially included as Cc:, but which can be added as a Cc:
!  easily with \\[mail-optional-cc]."
    (interactive "P")
  ;;; This is commented out because I found it was confusing in practice.
  ;;; It is easy enough to rename *mail* by hand with rename-buffer
***************
*** 860,866 ****
  	 (or (not (buffer-modified-p))
  	     (y-or-n-p "Unsent message being composed; erase it? "))
  	 (progn (erase-buffer)
! 		(mail-setup to subject in-reply-to cc replybuffer actions)
  		(setq initialized t)))
      (if (and buffer-auto-save-file-name
  	     (file-exists-p buffer-auto-save-file-name))
--- 880,886 ----
  	 (or (not (buffer-modified-p))
  	     (y-or-n-p "Unsent message being composed; erase it? "))
  	 (progn (erase-buffer)
! 		(mail-setup to subject in-reply-to cc replybuffer actions optional-cc)
  		(setq initialized t)))
      (if (and buffer-auto-save-file-name
  	     (file-exists-p buffer-auto-save-file-name))
--
The government which fears arms in the hands of its people...should.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads