From: Katsumi Yamaoka <yamaoka@jpl.org>
Cc: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: ietf-drums-parse-address, gnus-extract-address-components, mail-extract-address-components
Date: Mon, 30 Oct 2006 12:23:20 +0900 [thread overview]
Message-ID: <b9ypscazduf.fsf@jpl.org> (raw)
In-Reply-To: <v93b98oi3m.fsf@marauder.physik.uni-ulm.de>
>>>>> In <v93b98oi3m.fsf@marauder.physik.uni-ulm.de>
> 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\" <bar@baz>")
=> (nil " <bar@baz>")
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" <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 <address>" format is used.
(and address
;; Linear white space is not required.
--8<---------------cut here---------------end--------------->8---
next prev parent reply other threads:[~2006-10-30 3:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87mz851t59.fsf@mobile.repose.cx>
[not found] ` <g69hcy4t8g0.fsf@lifelogs.com>
2006-10-16 21:42 ` ietf-drums-parse-address, gnus-extract-address-components, mail-extract-address-components (was: bug in spam-check-BBDB) Reiner Steib
2006-10-16 22:47 ` ietf-drums-parse-address, gnus-extract-address-components, mail-extract-address-components Katsumi Yamaoka
2006-10-16 23:06 ` Miles Bader
2006-10-16 23:58 ` Katsumi Yamaoka
2006-10-17 14:58 ` Ted Zlatanov
2006-10-28 10:22 ` Reiner Steib
2006-10-30 3:23 ` Katsumi Yamaoka [this message]
2006-10-30 11:56 ` Reiner Steib
2006-10-30 19:00 ` Ted Zlatanov
2006-11-14 17:21 ` Reiner Steib
2006-11-14 23:41 ` Katsumi Yamaoka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b9ypscazduf.fsf@jpl.org \
--to=yamaoka@jpl.org \
--cc=tzz@lifelogs.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).