* mm-uu.el (mm-uu-pgp-signed-test): Erase prompt.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 25 Apr 2006 07:49:08 +0000 (07:49 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 25 Apr 2006 07:49:08 +0000 (07:49 +0000)
(mm-uu-pgp-encrypted-test): Ditto.
(mm-uu-pgp-encrypted-extract-1): Make sure there's a newline between header and
 body;
 return application/pgp-encrypted handle if decryption failed;
 decode decrypted body by charset.

* mm-decode.el (mm-automatic-display): Don't make application/pgp
 element match to application/pgp-*.

lisp/ChangeLog
lisp/mm-decode.el
lisp/mm-uu.el

index fb0442b..f9177a5 100644 (file)
@@ -1,3 +1,14 @@
+2006-04-25  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-uu.el (mm-uu-pgp-signed-test): Erase prompt.
+       (mm-uu-pgp-encrypted-test): Ditto.
+       (mm-uu-pgp-encrypted-extract-1): Make sure there's a newline
+       between header and body; return application/pgp-encrypted handle
+       if decryption failed; decode decrypted body by charset.
+
+       * mm-decode.el (mm-automatic-display): Don't make application/pgp
+       element match to application/pgp-*.
+
 2006-04-23  Andreas Seltenreich  <andreas+ding@gate450.dyndns.org>  (tiny change)
 
        * nnweb.el (nnweb-google-wash-article): Sync up to new Google
index cb35617..b3f976b 100644 (file)
@@ -307,7 +307,7 @@ when selecting a different article."
     "application/pkcs7-signature" "application/x-pkcs7-mime"
     "application/pkcs7-mime"
     ;; Mutt still uses this even though it has already been withdrawn.
-    "application/pgp")
+    "application/pgp\\'")
   "A list of MIME types to be displayed automatically."
   :type '(repeat regexp)
   :group 'mime-display)
index 85df48b..d67ea83 100644 (file)
@@ -461,7 +461,9 @@ apply the face `mm-uu-extract'."
     ((eq mm-verify-option 'never) nil)
     ((eq mm-verify-option 'always) t)
     ((eq mm-verify-option 'known) t)
-    (t (y-or-n-p "Verify pgp signed part? ")))))
+    (t (prog1
+          (y-or-n-p "Verify pgp signed part? ")
+        (message ""))))))
 
 (eval-when-compile
   (defvar gnus-newsgroup-charset))
@@ -512,15 +514,47 @@ apply the face `mm-uu-extract'."
     ((eq mm-decrypt-option 'never) nil)
     ((eq mm-decrypt-option 'always) t)
     ((eq mm-decrypt-option 'known) t)
-    (t (y-or-n-p "Decrypt pgp encrypted part? ")))))
+    (t (prog1
+          (y-or-n-p "Decrypt pgp encrypted part? ")
+        (message ""))))))
 
 (defun mm-uu-pgp-encrypted-extract-1 (handles ctl)
-  (let ((buf (mm-uu-copy-to-buffer (point-min) (point-max))))
-    (if (mm-uu-pgp-encrypted-test)
+  (let ((buf (mm-uu-copy-to-buffer (point-min) (point-max)))
+       (first t)
+       charset)
+    ;; Make sure there's a newline between header and body.
+    (with-current-buffer buf
+      (goto-char (point-min))
+      (while (prog2
+                (forward-line 1)
+                (if first
+                    (looking-at "[^\t\n ]+:")
+                  (looking-at "[^\t\n ]+:\\|[\t ]"))
+              (setq first nil)))
+      (unless (memq (char-after) '(?\n nil))
+       (insert "\n"))
+      (save-restriction
+       (narrow-to-region (point-min) (point))
+       (setq charset (mail-fetch-field "charset"))))
+    (if (and (mm-uu-pgp-encrypted-test)
+            (with-current-buffer buf
+              (mml2015-clean-buffer)
+              (funcall (mml2015-clear-decrypt-function))
+              (equal (mm-handle-multipart-ctl-parameter mm-security-handle
+                                                        'gnus-info)
+                     "OK")))
        (with-current-buffer buf
-         (mml2015-clean-buffer)
-         (funcall (mml2015-clear-decrypt-function))))
-    (list (mm-make-handle buf mm-uu-text-plain-type))))
+         ;; Remove leading newlines.
+         (goto-char (point-min))
+         (when (looking-at "\n+")
+           (delete-region (point-min) (match-end 0)))
+         ;; Decode charset.
+         (when (and charset
+                    (setq charset (mm-charset-to-coding-system charset))
+                    (not (eq charset 'ascii)))
+           (mm-decode-coding-region (point-min) (point-max) charset))
+         (list (mm-make-handle buf mm-uu-text-plain-type)))
+      (list (mm-make-handle buf '("application/pgp-encrypted"))))))
 
 (defun mm-uu-pgp-encrypted-extract ()
   (let ((mm-security-handle (list (format "multipart/encrypted"))))