Make epa-mail-encrypt expand mail aliases.
authorDaiki Ueno <ueno@unixuser.org>
Tue, 26 Oct 2010 01:31:27 +0000 (10:31 +0900)
committerDaiki Ueno <ueno@unixuser.org>
Tue, 26 Oct 2010 01:31:27 +0000 (10:31 +0900)
lisp/ChangeLog
lisp/epa-mail.el

index 723bb8d..4e9b62e 100644 (file)
@@ -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>
 
index 2b29e80..ab47cbf 100644 (file)
@@ -117,23 +117,29 @@ Don't use this command in Lisp programs!"
    (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))