Synch with Oort Gnus.
authoryamaoka <yamaoka>
Sun, 29 Sep 2002 22:17:01 +0000 (22:17 +0000)
committeryamaoka <yamaoka>
Sun, 29 Sep 2002 22:17:01 +0000 (22:17 +0000)
lisp/ChangeLog
lisp/mml1991.el

index 3d5747a..f843d15 100644 (file)
@@ -1,3 +1,12 @@
+2002-09-29  Simon Josefsson  <jas@extundo.com>
+
+       * mml1991.el (pgg-output-buffer, pgg-errors-buffer): Prevent byte
+       compile warnings.
+
+       * mml1991.el (mml1991-function-alist): Add pgg.
+       (mml1991-pgg-sign, mml1991-pgg-encrypt): New functions.
+       (mml1991-pgg-encrypt): Fix recipients querying.
+
 2002-09-28  Simon Josefsson  <jas@extundo.com>
 
        * mml2015.el (autoload): Autoload correct files.  Trivial patch
index a93f9d2..90d9e0f 100644 (file)
@@ -33,7 +33,9 @@
   '((mailcrypt mml1991-mailcrypt-sign
               mml1991-mailcrypt-encrypt)
     (gpg mml1991-gpg-sign
-        mml1991-gpg-encrypt))
+        mml1991-gpg-encrypt)
+    (pgg mml1991-pgg-sign
+        mml1991-pgg-encrypt))
   "Alist of PGP functions.")
 
 ;;; mailcrypt wrapper
        (insert-buffer cipher)
        (goto-char (point-max))))))
 
+;; pgg wrapper
+
+(defvar pgg-output-buffer)
+(defvar pgg-errors-buffer)
+
+(defun mml1991-pgg-sign (cont)
+  (let (headers)
+    ;; Don't sign headers.
+    (goto-char (point-min))
+    (while (not (looking-at "^$"))
+      (forward-line))
+    (unless (eobp) ;; no headers?
+      (setq headers (buffer-substring (point-min) (point)))
+      (forward-line) ;; skip header/body separator
+      (kill-region (point-min) (point)))
+    (unless (let ((pgg-gpg-user-id (message-options-get 'message-sender)))
+             (pgg-sign-region (point-min) (point-max) t))
+      (pop-to-buffer pgg-errors-buffer)
+      (error "Encrypt error"))
+    (kill-region (point-min) (point-max))
+    (if headers (insert headers))
+    (insert "\n")
+    (insert-buffer pgg-output-buffer)
+    t))
+
+(defun mml1991-pgg-encrypt (cont)
+  (let (headers)
+    ;; Don't sign headers.
+    (goto-char (point-min))
+    (while (not (looking-at "^$"))
+      (forward-line))
+    (unless (eobp) ;; no headers?
+      (setq headers (buffer-substring (point-min) (point)))
+      (forward-line) ;; skip header/body separator
+      (kill-region (point-min) (point)))
+    (unless (pgg-encrypt-region
+            (point-min) (point-max) 
+            (split-string
+             (or
+              (message-options-get 'message-recipients)
+              (message-options-set 'message-recipients
+                                   (read-string "Recipients: ")))
+             "[ \f\t\n\r\v,]+"))
+      (pop-to-buffer pgg-errors-buffer)
+      (error "Encrypt error"))
+    (kill-region (point-min) (point-max))
+    (if headers (insert headers))
+    (insert "\n")
+    (insert-buffer pgg-output-buffer)
+    t))
+
 ;;;###autoload
 (defun mml1991-encrypt (cont)
   (let ((func (nth 2 (assq mml1991-use mml1991-function-alist))))