* nnmail.el (nnmail-cache-insert): make sure that the
[gnus] / lisp / pgg.el
index b51bf2c..0481898 100644 (file)
     (require 'w3)
     (require 'url)))
 
-;; Fixme: Avoid this and use mm-make-temp-file (especially for
-;; something sensitive like pgp).
-(defvar pgg-temporary-file-directory
-  (cond ((fboundp 'temp-directory) (temp-directory))
-       ((boundp 'temporary-file-directory) temporary-file-directory)
-       ("/tmp/")))
-
 ;;; @ utility functions
 ;;;
 
   `(with-current-buffer pgg-output-buffer
      (if (zerop (buffer-size)) nil ,@body t)))
 
+(defalias 'pgg-make-temp-file
+  (if (fboundp 'make-temp-file)
+      'make-temp-file
+    (lambda (prefix &optional dir-flag)
+      (let ((file (expand-file-name
+                  (make-temp-name prefix)
+                  (if (fboundp 'temp-directory)
+                      (temp-directory)
+                    temporary-file-directory))))
+       (if dir-flag
+           (make-directory file))
+       file))))
+
 ;;; @ interface functions
 ;;;
 
@@ -186,15 +192,6 @@ the region."
   "Decrypt the current region between START and END."
   (interactive "r")
   (let* ((buf (current-buffer))
-        (packet (cdr (assq 1 (with-temp-buffer
-                               (insert-buffer-substring buf)
-                               (pgg-decode-armor-region
-                                (point-min) (point-max))))))
-        (key (cdr (assq 'key-identifier packet)))
-        (pgg-default-user-id 
-         (if key
-             (concat "0x" (pgg-truncate-key-identifier key))
-           pgg-default-user-id))
         (status
          (pgg-save-coding-system start end
            (pgg-invoke "decrypt-region" (or pgg-scheme pgg-default-scheme)