2000-11-06 16:02:52 ShengHuo ZHU <zsh@cs.rochester.edu>
authorShengHuo ZHU <zsh@cs.rochester.edu>
Mon, 6 Nov 2000 20:16:06 +0000 (20:16 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Mon, 6 Nov 2000 20:16:06 +0000 (20:16 +0000)
* mm-uu.el (mm-uu-gpg-key-skip-to-last): New function.
(mm-uu-pgp-key-extract): Use application/pgp-keys, don't snarf,
let mailcap do it.
* mml2015.el: Remove snarf code.
* mm-decode.el: Remove snarf code.

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

index 4c6e7a2..c0999b5 100644 (file)
@@ -1,3 +1,11 @@
+2000-11-06 16:02:52  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * mm-uu.el (mm-uu-gpg-key-skip-to-last): New function.
+       (mm-uu-pgp-key-extract): Use application/pgp-keys, don't snarf,
+       let mailcap do it.
+       * mml2015.el: Remove snarf code.
+       * mm-decode.el: Remove snarf code.
+
 2000-11-06 14:03:10  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * mml.el (mml-insert-mml-markup): Ignore internal stuff.
index a2e4d0d..66db063 100644 (file)
@@ -271,16 +271,6 @@ to:
                 (item :tag "ask" nil))
   :group 'mime-security)
 
-(defcustom mm-snarf-option nil
-  "Option of snarfing PGP key.
-`never', not snarf; `always', always snarf; 
-`known', only snarf known protocols. Otherwise, ask user."
-  :type '(choice (item always)
-                (item never)
-                (item :tag "only known protocols" known)
-                (item :tag "ask" nil))
-  :group 'mime-security)
-
 (defvar mm-viewer-completion-map
   (let ((map (make-sparse-keymap 'mm-viewer-completion-map)))
     (set-keymap-parent map minibuffer-local-completion-map)
index 1ad1497..7a7181d 100644 (file)
@@ -57,10 +57,10 @@ decoder, such as hexbin."
                 (item :tag "external" binhex-decode-region-external))
   :group 'gnus-article-mime) 
 
-(defvar mm-uu-pgp-begin-signature
+(defvar mm-uu-pgp-beginning-signature
      "^-----BEGIN PGP SIGNATURE-----")
 
-(defvar mm-uu-begin-line nil)
+(defvar mm-uu-beginning-regexp nil)
 
 (defvar mm-dissect-disposition "inline"
   "The default disposition of uu parts.
@@ -115,8 +115,8 @@ This can be either \"inline\" or \"attachment\".")
      "^-----BEGIN PGP PUBLIC KEY BLOCK-----"
      "^-----END PGP PUBLIC KEY BLOCK-----"
      mm-uu-pgp-key-extract
-     nil
-     mm-uu-pgp-key-test)))
+     mm-uu-gpg-key-skip-to-last
+     nil)))
 
 (defcustom mm-uu-configure-list nil
   "A list of mm-uu configuration.
@@ -136,7 +136,7 @@ To disable dissecting shar codes, for instance, add
 (defsubst mm-uu-type (entry)
   (car entry))
 
-(defsubst mm-uu-begin-regexp (entry)
+(defsubst mm-uu-beginning-regexp (entry)
   (nth 1 entry))
 
 (defsubst mm-uu-end-regexp (entry)
@@ -164,14 +164,14 @@ To disable dissecting shar codes, for instance, add
 
 (defun mm-uu-configure (&optional symbol value)
   (if symbol (set-default symbol value))
-  (setq mm-uu-begin-line nil)
+  (setq mm-uu-beginning-regexp nil)
   (mapcar (lambda (entry)
             (if (mm-uu-configure-p (mm-uu-type entry) 'disabled) 
                 nil
-              (setq mm-uu-begin-line
-                    (concat mm-uu-begin-line
-                            (if mm-uu-begin-line "\\|")
-                            (mm-uu-begin-regexp entry)))))
+              (setq mm-uu-beginning-regexp
+                    (concat mm-uu-beginning-regexp
+                            (if mm-uu-beginning-regexp "\\|")
+                            (mm-uu-beginning-regexp entry)))))
          mm-uu-type-alist))
 
 (mm-uu-configure)
@@ -270,7 +270,7 @@ To disable dissecting shar codes, for instance, add
       (goto-char (point-min))
       (if (search-forward "\n\n" nil t)
          (delete-region (point-min) (point)))
-      (if (re-search-forward mm-uu-pgp-begin-signature nil t)
+      (if (re-search-forward mm-uu-pgp-beginning-signature nil t)
          (delete-region (match-beginning 0) (point-max))))
     (mm-make-handle buf
                    '("text/plain"  (charset . gnus-decoded)))))
@@ -299,22 +299,22 @@ To disable dissecting shar codes, for instance, add
     (mm-make-handle buf
                    '("text/plain"  (charset . gnus-decoded)))))
 
-(defun mm-uu-pgp-key-test ()
-  (and
-   mml2015-use
-   (mml2015-clear-snarf-function)
-   (cond
-    ((eq mm-snarf-option 'never) nil)
-    ((eq mm-snarf-option 'always) t)
-    ((eq mm-snarf-option 'known) t)
-    (t (y-or-n-p "Snarf pgp signed part?")))))
+(defun mm-uu-gpg-key-skip-to-last ()
+  (let ((point (point))
+       (end-regexp (mm-uu-end-regexp entry))
+       (beginning-regexp (mm-uu-beginning-regexp entry)))
+    (when (and end-regexp
+              (not (mm-uu-configure-p (mm-uu-type entry) 'disabled)))
+      (while (re-search-forward end-regexp nil t)
+       (skip-chars-forward " \t\n\r")
+       (if (looking-at beginning-regexp)
+           (setq point (match-end 0)))))
+    (goto-char point)))
 
 (defun mm-uu-pgp-key-extract ()
   (let ((buf (mm-uu-copy-to-buffer start-point end-point)))
-    (with-current-buffer buf
-      (funcall (mml2015-clear-snarf-function)))
     (mm-make-handle buf
-                   '("application/x-pgp-key"))))
+                   '("application/pgp-keys"))))
 
 ;;;### autoload
 (defun mm-uu-dissect ()
@@ -334,23 +334,24 @@ To disable dissecting shar codes, for instance, add
       ;;; decoding.
       (setq text-start (point)
            text-plain-type '("text/plain"  (charset . gnus-decoded)))
-      (while (re-search-forward mm-uu-begin-line nil t)
+      (while (re-search-forward mm-uu-beginning-regexp nil t)
        (setq start-point (match-beginning 0))
        (let ((alist mm-uu-type-alist)
-             (begin-line (match-string 0)))
+             (beginning-regexp (match-string 0)))
          (while (not entry)
-           (if (string-match (mm-uu-begin-regexp (car alist)) begin-line)
+           (if (string-match (mm-uu-beginning-regexp (car alist)) 
+                             beginning-regexp)
                (setq entry (car alist))
              (pop alist))))
        (if (setq func (mm-uu-function-1 entry))
            (funcall func))
        (forward-line);; in case of failure
        (when (and (not (mm-uu-configure-p (mm-uu-type entry) 'disabled))
-                   (let ((end-line (mm-uu-end-regexp entry)))
-                    (if (not end-line)
+                   (let ((end-regexp (mm-uu-end-regexp entry)))
+                    (if (not end-regexp)
                         (or (setq end-point (point-max)) t)
                       (prog1
-                          (re-search-forward end-line nil t)
+                          (re-search-forward end-regexp nil t)
                         (forward-line)
                         (setq end-point (point)))))
                   (or (not (setq func (mm-uu-function-2 entry)))
index 04b523b..46385b1 100644 (file)
               mml2015-mailcrypt-verify
               mml2015-mailcrypt-decrypt
               mml2015-mailcrypt-clear-verify
-              mml2015-mailcrypt-clear-decrypt
-              mml2015-mailcrypt-clear-snarf)
+              mml2015-mailcrypt-clear-decrypt) 
     (gpg mml2015-gpg-sign
         mml2015-gpg-encrypt
         mml2015-gpg-verify
         mml2015-gpg-decrypt
         nil
-        mml2015-gpg-clear-decrypt
-        nil))
+        mml2015-gpg-clear-decrypt))
   "Alist of PGP/MIME functions.")
 
 (defvar mml2015-result-buffer nil)
@@ -69,8 +67,7 @@
   (autoload 'mc-pgp-always-sign "mailcrypt")
   (autoload 'mc-encrypt-generic "mc-toplev")
   (autoload 'mc-cleanup-recipient-headers "mc-toplev")
-  (autoload 'mc-sign-generic "mc-toplev")
-  (autoload 'mc-snarf-keys "mc-toplev"))
+  (autoload 'mc-sign-generic "mc-toplev"))
 
 (eval-when-compile
   (defvar mc-default-scheme)
@@ -78,7 +75,6 @@
 
 (defvar mml2015-decrypt-function 'mailcrypt-decrypt)
 (defvar mml2015-verify-function 'mailcrypt-verify)
-(defvar mml2015-snarf-function 'mc-snarf-keys)
 
 (defun mml2015-mailcrypt-decrypt (handle ctl)
   (let (child handles result)
   (unless (funcall mml2015-verify-function)
     (error "Verify error.")))
 
-(defun mml2015-mailcrypt-clear-snarf ()
-  (funcall mml2015-snarf-function))
-
 (defun mml2015-mailcrypt-sign (cont)
   (mc-sign-generic (message-options-get 'message-sender)
                   nil nil nil nil)
          (gnus-get-buffer-create "*MML2015 Result*"))
     nil))
 
-(defsubst mml2015-clear-snarf-function ()
-  (nth 7 (assq mml2015-use mml2015-function-alist)))
-
 (defsubst mml2015-clear-decrypt-function ()
   (nth 6 (assq mml2015-use mml2015-function-alist)))