* wl-mime.el (wl-message-verify-pgp-nonmime): With arg, ask coding
authoryoichi <yoichi>
Sun, 17 Nov 2002 11:49:11 +0000 (11:49 +0000)
committeryoichi <yoichi>
Sun, 17 Nov 2002 11:49:11 +0000 (11:49 +0000)
system and encode the region with it before verifying.

wl/ChangeLog
wl/wl-mime.el

index ca35b30..51fce62 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-17  Yoichi NAKAYAMA  <yoichi@eken.phys.nagoya-u.ac.jp>
+
+       * wl-mime.el (wl-message-verify-pgp-nonmime): With arg, ask coding
+       system and encode the region with it before verifying.
+
 2002-11-15  Yoichi NAKAYAMA  <yoichi@eken.phys.nagoya-u.ac.jp>
 
        * wl-mime.el (wl-message-verify-pgp-nonmime): Encode by the coding
index 4627e48..4efa3d1 100644 (file)
@@ -311,50 +311,59 @@ It calls following-method selected from variable
            (message "Cannot find pgp encrypted region")))
       (message "Cannot find pgp encrypted region"))))
 
-(defun wl-message-verify-pgp-nonmime ()
-  "Verify PGP signed region"
-  (interactive)
+(defun wl-message-verify-pgp-nonmime (&optional arg)
+  "Verify PGP signed region.
+With ARG, ask coding system and encode the region with it before verifying."
+  (interactive "P")
   (require 'pgg)
   (save-excursion
     (beginning-of-line)
-    (if (and (or (re-search-forward "^-+END PGP SIGNATURE-+$" nil t)
-                (re-search-backward "^-+END PGP SIGNATURE-+$" nil t))
-            (re-search-backward "^-+BEGIN PGP SIGNED MESSAGE-+$" nil t))
-       (let (status m-beg)
-         (let* ((beg (point))
-                (situation (mime-preview-find-boundary-info))
-                (p-end (aref situation 1))
-                (entity (aref situation 2))
-                (count 0))
-           (goto-char p-end)
-           (while (< beg (point))
-             (if (re-search-backward "^-+BEGIN PGP SIGNED MESSAGE-+$" nil t)
-                 (setq count (+ count 1))
-               (debug)))
-           (with-temp-buffer
-             (set-buffer-multibyte nil)
-             (insert (mime-entity-body entity))
-             (goto-char (point-max))
-             (while (> count 0)
-               (if (re-search-backward "^-+BEGIN PGP SIGNED MESSAGE-+$" nil t)
-                   (setq count (- count 1))
-                 (debug)))
-             (let ((r-beg (point))
-                   (r-end (re-search-forward "^-+END PGP SIGNATURE-+$" nil t)))
-               (if r-end
-                   (setq status (pgg-verify-region r-beg r-end nil 'fetch))
-                 (debug)))))
-         (mime-show-echo-buffer)
-         (set-buffer mime-echo-buffer-name)
-         (set-window-start
-          (get-buffer-window mime-echo-buffer-name)
-          (point-max))
-         (setq m-beg (point))
-         (insert-buffer-substring
-          (if status pgg-output-buffer pgg-errors-buffer))
-         (encode-coding-region m-beg (point) buffer-file-coding-system)
-         (decode-coding-region m-beg (point) wl-cs-autoconv))
-      (message "Cannot find pgp signed region"))))
+    (let ((msg-buf (current-buffer))
+         beg end status m-beg)
+      (if (and (when (or (re-search-forward "^-+END PGP SIGNATURE-+$" nil t)
+                        (re-search-backward "^-+END PGP SIGNATURE-+$" nil t))
+                (setq end (match-end 0)))
+              (setq beg (re-search-backward "^-+BEGIN PGP SIGNED MESSAGE-+$" nil t)))
+         (progn
+           (if arg
+               (with-temp-buffer
+                 (insert-buffer-substring msg-buf beg end)
+                 (set-mark (point-min))
+                 (goto-char (point-max))
+                 (call-interactively 'encode-coding-region)
+                 (setq status (pgg-verify-region (point-min) (point-max) nil 'fetch)))
+             (let* ((situation (mime-preview-find-boundary-info))
+                    (p-end (aref situation 1))
+                    (entity (aref situation 2))
+                    (count 0))
+               (goto-char p-end)
+               (while (< beg (point))
+                 (if (re-search-backward "^-+BEGIN PGP SIGNED MESSAGE-+$" nil t)
+                     (setq count (+ count 1))
+                   (debug)))
+               (with-temp-buffer
+                 (insert (mime-entity-body entity))
+                 (goto-char (point-max))
+                 (while (> count 0)
+                   (if (re-search-backward "^-+BEGIN PGP SIGNED MESSAGE-+$" nil t)
+                       (setq count (- count 1))
+                     (debug)))
+                 (let ((r-beg (point))
+                       (r-end (re-search-forward "^-+END PGP SIGNATURE-+$" nil t)))
+                   (if r-end
+                       (setq status (pgg-verify-region r-beg r-end nil 'fetch))
+                     (debug))))))
+           (mime-show-echo-buffer)
+           (set-buffer mime-echo-buffer-name)
+           (set-window-start
+            (get-buffer-window mime-echo-buffer-name)
+            (point-max))
+           (setq m-beg (point))
+           (insert-buffer-substring
+            (if status pgg-output-buffer pgg-errors-buffer))
+           (encode-coding-region m-beg (point) buffer-file-coding-system)
+           (decode-coding-region m-beg (point) wl-cs-autoconv))
+       (message "Cannot find pgp signed region")))))
 
 ;; XXX: encrypted multipart isn't represented as multipart
 (defun wl-mime-preview-application/pgp (parent-entity entity situation)