diff lisp/mh-e/mh-mime.el @ 91010:aaccdab0ee26

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 852-856) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 93-96) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 245) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-249
author Miles Bader <miles@gnu.org>
date Tue, 21 Aug 2007 04:54:03 +0000
parents f55f9811f5d7 c51f2772210a
children b83d0dadb2a7
line wrap: on
line diff
--- a/lisp/mh-e/mh-mime.el	Mon Aug 20 11:24:57 2007 +0000
+++ b/lisp/mh-e/mh-mime.el	Tue Aug 21 04:54:03 2007 +0000
@@ -60,7 +60,10 @@
 (autoload 'mail-decode-encoded-word-string "mail-parse")
 (autoload 'mail-header-parse-content-type "mail-parse")
 (autoload 'mail-header-strip "mail-parse")
+(autoload 'message-options-get "message")
+(autoload 'message-options-set "message")
 (autoload 'message-options-set-recipient "message")
+(autoload 'mh-alias-expand "mh-alias")
 (autoload 'mm-decode-body "mm-bodies")
 (autoload 'mm-uu-dissect "mm-uu")
 (autoload 'mml-unsecure-message "mml-sec")
@@ -1220,16 +1223,11 @@
                  mh-sent-from-msg
                (string-to-number message))))
     (cond ((integerp msg)
-           (if (string= "" description)
-               ;; Rationale: mml-attach-file constructs a malformed composition
-               ;; if the description string is empty.  This fixes SF #625168.
-               (mml-attach-file (format "%s%s/%d"
-                                        mh-user-path (substring folder 1) msg)
-                                "message/rfc822")
-             (mml-attach-file (format "%s%s/%d"
-                                      mh-user-path (substring folder 1) msg)
-                              "message/rfc822"
-                              description)))
+           (mml-attach-file (format "%s%s/%d"
+                                    mh-user-path (substring folder 1) msg)
+                            "message/rfc822"
+                            (if (string= "" description) nil description)
+                            "inline"))
           (t (error "The message number, %s, is not a integer" msg)))))
 
 (defun mh-mh-forward-message (&optional description folder messages)
@@ -1621,8 +1619,22 @@
 This action can be undone by running \\[undo]."
   (interactive)
   (require 'message)
-  (when mh-pgp-support-flag ;; This is only needed for PGP
-    (message-options-set-recipient))
+  (when mh-pgp-support-flag
+    ;; PGP requires actual e-mail addresses, not aliases.
+    ;; Parse the recipients and sender from the message
+    (message-options-set-recipient)
+    ;; Do an alias lookup on sender
+    (message-options-set 'message-sender
+                     (mail-strip-quoted-names
+                      (mh-alias-expand
+                       (message-options-get 'message-sender))))
+    ;; Do an alias lookup on recipients
+    (message-options-set 'message-recipients
+                         (mapconcat
+                          '(lambda (ali)
+                             (mail-strip-quoted-names (mh-alias-expand ali)))
+                          (split-string (message-options-get 'message-recipients) "[, ]+")
+                          ", ")))
   (let ((saved-text (buffer-string))
         (buffer (current-buffer))
         (modified-flag (buffer-modified-p)))