🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.vm.bug
Article #8690

vm-summary.el: vm-su-do-author

#8690
From: Kevin Rodgers
Date: Tue, 24 Aug 1993 18:59
125 lines
5490 bytes
[Sorry about the blank message I previously fired off.]

Here's a patch that strips enclosing double-quotes (if present) when
parsing the author's full-name.  It is not robust in the presence of
intervening double quotes, e.g.

	From: "First \"Nickname\" Last" <user@host.domain>

This patch requires the other patches to vm-su-do-author (version 5.33)
I've submitted; the patch which follows the page delimiter (\C-l)
accumulates all my changes from the 5.33 distribution:

	In vm-su-do-author, fixed the regexps that are used to parse the
	'from' and 'full-name' attributes so that (1) nested parentheses
	are recognized in the "address (full-name)" format, and (2)
	arbitary names are recognized in the "full-name <address>"
	format.

	In vm-su-do-author, trim trailing whitespace from first of the
	'from' and 'full-name' attributes when parsed from the "address
	(full-name)" or "full-name <address>" formats; also fixed typo
	when parsing the "address (full-name)" format.

	In vm-su-do-author, ignore optional double-quotes delimiting the
	full-name in the "full-name <address>" format.

SCCS/s.vm-summary.el: 1.4 vs. 1.5
*** /tmp/geta9425	Tue Aug 24 12:45:30 1993
--- /tmp/getb9425	Tue Aug 24 12:45:30 1993
***************
*** 581,587 ****
  	   (setq from "???")
  	   (if (null full-name)
  	       (setq full-name "???")))
! 	  ((string-match "^\\s *\\([^<]+\\)<\\(.+\\)>\\s *$" from)
  	   (if (null full-name)
  	       (setq full-name
  		     (funcall trim-func
--- 581,587 ----
  	   (setq from "???")
  	   (if (null full-name)
  	       (setq full-name "???")))
! 	  ((string-match "^\\s *\"?\\([^<\"]+\\)\"?\\s *<\\(.+\\)>\\s *$" from)
  	   (if (null full-name)
  	       (setq full-name
  		     (funcall trim-func

SCCS/s.vm-summary.el: 1.1 vs. 1.5
*** /tmp/geta9440	Tue Aug 24 12:57:37 1993
--- /tmp/getb9440	Tue Aug 24 12:57:38 1993
***************
*** 566,572 ****
  	    (buffer-substring (match-beginning 1) (match-end 1)))))))
  
  (defun vm-su-do-author (m)
!   (let (full-name from)
      (setq full-name (vm-get-header-contents m "Full-Name"))
      (setq from (or (vm-get-header-contents m "From") (vm-grok-From_-author m)))
      (cond ((null from)
--- 566,580 ----
  	    (buffer-substring (match-beginning 1) (match-end 1)))))))
  
  (defun vm-su-do-author (m)
!   (let ((trim-func (function (lambda (string)
! 			       (let ((match-data (match-data)))
! 				 (unwind-protect
! 				     (if (string-match "\\s +\\'" string)
! 					 (substring string
! 						    0 (match-beginning 0))
! 				       string)
! 				   (store-match-data match-data))))))
! 	full-name from)
      (setq full-name (vm-get-header-contents m "Full-Name"))
      (setq from (or (vm-get-header-contents m "From") (vm-grok-From_-author m)))
      (cond ((null from)
***************
*** 573,592 ****
  	   (setq from "???")
  	   (if (null full-name)
  	       (setq full-name "???")))
! 	  ((string-match "^\\([^< \t\n]+\\([ \t\n]+[^< \t\n]+\\)*\\)?[ \t\n]*\\(<\\([^>]+\\)>\\)"
! 			 from)
! 	   (if (and (match-beginning 1) (null full-name))
  	       (setq full-name
! 		     (substring from (match-beginning 1) (match-end 1))))
! 	   (setq from (substring from (match-beginning 4) (match-end 4))))
! 	  ((string-match "[\000-\177]*(\\([^)]+\\))[\000-\177]*" from)
  	   (if (null full-name)
! 	       (setq full-name (substring from (match-beginning 1)
! 					  (match-end 1))))
  	   (setq from
! 		 (concat
! 		  (substring from (match-beginning 0) (1- (match-beginning 1)))
! 		  (substring from (1+ (match-end 1)) (match-end 0))))))
      ;; ewe ewe see pee...
      (if (and vm-gargle-uucp (string-match
  "\\([^!@:.]+\\)\\(\\.[^!@:]+\\)?!\\([^!@: \t\n]+\\)\\(@\\([^!@:. \t\n]+\\)\\(.[^ \t\n]+\\)?\\)?[ \t\n]*$"
--- 581,601 ----
  	   (setq from "???")
  	   (if (null full-name)
  	       (setq full-name "???")))
! 	  ((string-match "^\\s *\"?\\([^<\"]+\\)\"?\\s *<\\(.+\\)>\\s *$" from)
! 	   (if (null full-name)
  	       (setq full-name
! 		     (funcall trim-func
! 			      (substring from
! 					 (match-beginning 1) (match-end 1)))))
! 	   (setq from (substring from (match-beginning 2) (match-end 2))))
! 	  ((string-match "^\\s *\\([^(]+\\)(\\(.+\\))\\s *$" from)
  	   (if (null full-name)
! 	       (setq full-name
! 		     (substring from (match-beginning 2) (match-end 2))))
  	   (setq from
! 		 (funcall trim-func
! 			  (substring from
! 				     (match-beginning 1) (match-end 1))))))
      ;; ewe ewe see pee...
      (if (and vm-gargle-uucp (string-match
  "\\([^!@:.]+\\)\\(\\.[^!@:]+\\)?!\\([^!@: \t\n]+\\)\\(@\\([^!@:. \t\n]+\\)\\(.[^ \t\n]+\\)?\\)?[ \t\n]*$"
--
Kevin Rodgers				kevin@traffic.den.mmc.com
Martin Marietta MS DC5695		(303) 971-2396
P.O. Box 179
Denver CO 80201 USA			GO BUFFS!
Technical Details
Message-ID: <9308241859.AA09452@traffic.den.mmc.com>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!uunet!wendy-fate.uu.net!bug-vm

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6829,d8f7a9e51052998e
X-Google-Attributes: gidf6829,public
X-Google-ArrivalTime: 1993-08-24 12:16:15 PST
x-gateway: relay1.UU.NET from bug-vm to gnu.emacs.vm.bug; Tue, 24 Aug 1993 14:59:14 EDT
Date: Tue, 24 Aug 1993 12:59:05 MDT
From: kevin@traffic.den.mmc.com (Kevin Rodgers)
Message-ID: <9308241859.AA09452@traffic.den.mmc.com>
Subject: vm-summary.el: vm-su-do-author
Newsgroups: gnu.emacs.vm.bug
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!uunet!wendy-fate.uu.net!bug-vm
Sender: bug-vm-request@uunet.uu.net
Lines: 125