From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/63915 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: ietf-drums-parse-address, gnus-extract-address-components, mail-extract-address-components Date: Mon, 30 Oct 2006 12:23:20 +0900 Organization: Emacsen advocacy group Message-ID: References: <87mz851t59.fsf@mobile.repose.cx> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1162179067 5785 80.91.229.2 (30 Oct 2006 03:31:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 30 Oct 2006 03:31:07 +0000 (UTC) Cc: Ted Zlatanov Original-X-From: ding-owner+m12442@lists.math.uh.edu Mon Oct 30 04:31:04 2006 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GeNrU-0001BW-M6 for ding-account@gmane.org; Mon, 30 Oct 2006 04:30:56 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1GeNqw-00058j-00; Sun, 29 Oct 2006 21:30:22 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1GeNmb-00058d-00 for ding@lists.math.uh.edu; Sun, 29 Oct 2006 21:25:53 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.63) (envelope-from ) id 1GeNmY-0005VT-9U for ding@lists.math.uh.edu; Sun, 29 Oct 2006 21:25:53 -0600 Original-Received: from unknown.scnet.net ([216.246.45.90] helo=orlando.hostforweb.net) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1GeNmT-0002A6-00 for ; Mon, 30 Oct 2006 04:25:45 +0100 Original-Received: from [216.246.45.90] (helo=mail.jpl.org) by orlando.hostforweb.net with esmtpa (Exim 4.52) id 1GeNmV-0006qe-1A; Sun, 29 Oct 2006 21:25:47 -0600 Original-To: ding@gnus.org X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.90 (usg-unix-v) Cancel-Lock: sha1:69TluSOJOtEfZ8zPX+IAWT0e7uc= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -2.5 (--) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:63915 Archived-At: >>>>> In > Here's a suggestion for such a fix. Does anyone see a problem with > it? It doesn't strip brackets and whitespace: (gnus-extract-address-components "\"foo@bar\" ") => (nil " ") In addition, "foo@bar" might be a valid (nick)name of the sender. How about the following? --8<---------------cut here---------------start------------->8--- --- gnus-util.el~ 2006-10-03 06:40:00 +0000 +++ gnus-util.el 2006-10-30 03:20:42 +0000 @@ -173,8 +173,12 @@ ;; First find the address - the thing with the @ in it. This may ;; not be accurate in mail addresses, but does the trick most of ;; the time in news messages. - (when (string-match "\\b[^@ \t<>]+[!@][^@ \t<>]+\\b" from) - (setq address (substring from (match-beginning 0) (match-end 0)))) + (cond (;; Special case: "foo@bar" , i.e. one @ in the comment + ;; and one in the address. + (string-match "<\\([^@ \t<>]+[!@][^@ \t<>]+\\)>" from) + (setq address (substring from (match-beginning 1) (match-end 1)))) + ((string-match "\\b[^@ \t<>]+[!@][^@ \t<>]+\\b" from) + (setq address (substring from (match-beginning 0) (match-end 0))))) ;; Then we check whether the "name
" format is used. (and address ;; Linear white space is not required. --8<---------------cut here---------------end--------------->8---