changeset 111182:d6dad5b04eb8

Make epa-mail-encrypt expand mail aliases.
author Daiki Ueno <ueno@unixuser.org>
date Tue, 26 Oct 2010 10:31:27 +0900
parents 6585f38b9f1d
children 72ef880ed198
files lisp/ChangeLog lisp/epa-mail.el
diffstat 2 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Oct 26 10:02:08 2010 +0900
+++ b/lisp/ChangeLog	Tue Oct 26 10:31:27 2010 +0900
@@ -1,7 +1,7 @@
 2010-10-26  Daiki Ueno  <ueno@unixuser.org>
 
 	* epa-mail.el (epa-mail-encrypt): Handle local-part only
-	recipients (Bug#7280).
+	recipients; expand mail aliases (Bug#7280).
 
 2010-10-25  Glenn Morris  <rgm@gnu.org>
 
--- a/lisp/epa-mail.el	Tue Oct 26 10:02:08 2010 +0900
+++ b/lisp/epa-mail.el	Tue Oct 26 10:31:27 2010 +0900
@@ -117,23 +117,29 @@
    (save-excursion
      (let ((verbose current-prefix-arg)
 	   (context (epg-make-context epa-protocol))
-	   recipients recipient-key)
+	   recipients-string recipients recipient-key)
        (goto-char (point-min))
        (save-restriction
 	 (narrow-to-region (point)
 			   (if (search-forward mail-header-separator nil 0)
 			       (match-beginning 0)
 			     (point)))
+	 (setq recipients-string
+	       (mapconcat #'identity
+			  (nconc (mail-fetch-field "to" nil nil t)
+				 (mail-fetch-field "cc" nil nil t)
+				 (mail-fetch-field "bcc" nil nil t))
+			  ","))
 	 (setq recipients
 	       (mail-strip-quoted-names
-		(mapconcat #'identity
-			   (nconc (mail-fetch-field "to" nil nil t)
-				  (mail-fetch-field "cc" nil nil t)
-				  (mail-fetch-field "bcc" nil nil t))
-			   ","))))
+		(with-temp-buffer
+		  (insert "to: " recipients-string "\n")
+		  (expand-mail-aliases (point-min) (point-max))
+		  (car (mail-fetch-field "to" nil nil t))))))
        (if recipients
 	   (setq recipients (delete ""
-				    (split-string recipients "[ \t\n]+"))))
+				    (split-string recipients
+						  "[ \t\n]*,[ \t\n]*"))))
        (goto-char (point-min))
        (if (search-forward mail-header-separator nil t)
 	   (forward-line))