Article View: gnu.emacs.vm.bug
Article #9518vm-su-do-recipients bug
From: Jamie Zawinski
Date: Mon, 13 May 1991 20:45
Date: Mon, 13 May 1991 20:45
72 lines
2961 bytes
2961 bytes
vm-su-do-recipients doesn't order the "to" and "to-names" lists the same way.
For example, given a message with headers
To: Some Name <addr1>
Cc: addr2, addr3
(vm-su-to-names msg) ==> "addr3, addr2, Some Name"
(vm-su-to msg) ==> "addr1, addr2, addr3"
This caused my rolodex thingy to act really goofy, because it was assuming it
could chop these strings at the first comma to get the first recipient name
and address; instead the first address was getting mapped to the last name.
Here's the one-line fix:
(defun vm-su-do-recipients (m)
(let ((mail-use-rfc822 t) names addresses to cc all list)
(setq to (or (vm-get-header-contents m "To")
(vm-get-header-contents m "Apparently-To")
;; desperation....
(user-login-name))
cc (vm-get-header-contents m "Cc")
all to
all (if all (concat all ", " cc) cc)
addresses (rfc822-addresses all))
(setq list (vm-parse-addresses all))
(while list
(cond ((string= (car list) ""))
((string-match "^\\(\\([^<]+[^ \t\n]\\)[ \t\n]+\\)?<\\([^>]+\\)>"
(car list))
(if (match-beginning 2)
(setq names
(cons
(substring (car list) (match-beginning 2)
(match-end 2))
names))
(setq names
(cons
(substring (car list) (match-beginning 3)
(match-end 3))
names))))
((string-match "[\000-\177]*(\\([^)]+\\))[\000-\177]*" (car list))
(setq names
(cons (substring (car list) (match-beginning 1)
(match-end 1))
names)))
(t (setq names (cons (car list) names))))
(setq list (cdr list)))
(setq names (nreverse names)) ;; ## added by jwz
(if vm-gargle-uucp
(while list
(if (string-match
"\\([^!@:.]+\\)\\(\\.[^!@:]+\\)?!\\([^!@: \t\n]+\\)\\(@\\([^!@:. \t\n]+\\)\\(.[^ \t\n]+\\)?\\)?[ \t\n]*$"
(car list))
(setcar
list
(concat
(substring (car list) (match-beginning 3)
(match-end 3))
"@"
(if (and (match-beginning 5) (match-beginning 2)
(not (match-beginning 6)))
(concat (substring (car list) (match-beginning 5)
(match-end 5))
".")
"")
(substring (car list) (match-beginning 1)
(or (match-end 2) (match-end 1)))
(if (match-end 2) "" ".UUCP"))))
(setq list (cdr list))))
(vm-set-to-of m (mapconcat 'identity addresses ", "))
(vm-set-to-names-of m (mapconcat 'identity names ", "))))
Technical Details
Message-ID:
<9105132045.AA28435@thalidomide>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!wendy-fate.uu.net!bug-vmShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f6829,b2fecf38f39ff85,start X-Google-Attributes: gidf6829,public X-Google-ArrivalTime: 1991-05-14 01:25:07 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!wendy-fate.uu.net!bug-vm From: jwz%thalidomide@lucid.com (Jamie Zawinski) Newsgroups: gnu.emacs.vm.bug Subject: vm-su-do-recipients bug Message-ID: <9105132045.AA28435@thalidomide> Date: 13 May 91 20:45:24 GMT Sender: bug-vm-request@uunet.uu.net Lines: 72 X-Windows: Even your dog won't like it.