From 70f67588075204d47d573c2c5725a0083c7093a2 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Sun, 29 Sep 2002 22:17:01 +0000 Subject: [PATCH] Synch with Oort Gnus. --- lisp/ChangeLog | 9 +++++++++ lisp/mml1991.el | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3d5747a..f843d15 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2002-09-29 Simon Josefsson + + * 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 * mml2015.el (autoload): Autoload correct files. Trivial patch diff --git a/lisp/mml1991.el b/lisp/mml1991.el index a93f9d2..90d9e0f 100644 --- a/lisp/mml1991.el +++ b/lisp/mml1991.el @@ -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 @@ -192,6 +194,57 @@ (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)))) -- 1.7.10.4