(mm-codepage-setup): New helper function.
[gnus] / lisp / pgg-pgp.el
index ca686e9..2735a0b 100644 (file)
@@ -1,6 +1,7 @@
 ;;; pgg-pgp.el --- PGP 2.* and 6.* support for PGG.
 
-;; Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2002, 2003, 2004,
+;;   2005 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1999/11/02
@@ -20,8 +21,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Code:
 
@@ -30,7 +31,7 @@
   (require 'pgg))
 
 (defgroup pgg-pgp ()
-  "PGP 2.* and 6.* interface"
+  "PGP 2.* and 6.* interface."
   :group 'pgg)
 
 (defcustom pgg-pgp-program "pgp"
@@ -148,14 +149,16 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"."
 (defun pgg-pgp-decrypt-region (start end)
   "Decrypt the current region between START and END."
   (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id))
+        (key (pgg-pgp-lookup-key pgg-pgp-user-id 'encrypt))
         (passphrase
          (pgg-read-passphrase
-          (format "PGP passphrase for %s: " pgg-pgp-user-id)
-          (pgg-pgp-lookup-key pgg-pgp-user-id 'encrypt)))
+          (format "PGP passphrase for %s: " pgg-pgp-user-id) key))
         (args
          '("+verbose=1" "+batchmode" "+language=us" "-f")))
     (pgg-pgp-process-region start end passphrase pgg-pgp-program args)
-    (pgg-process-when-success nil)))
+    (pgg-process-when-success
+      (if pgg-cache-passphrase
+         (pgg-add-passphrase-cache key passphrase)))))
 
 (defun pgg-pgp-sign-region (start end &optional clearsign)
   "Make detached signature from text between START and END."