]> code.delx.au - gnu-emacs/blobdiff - lisp/gnus/plstore.el
Remove compat function from pop3
[gnu-emacs] / lisp / gnus / plstore.el
index 2f446c84071f9b7944acc0f7b19748123adb0a86..62c50c0f4a184beebcc1c8b960a57f8bf137c434 100644 (file)
@@ -1,5 +1,5 @@
 ;;; plstore.el --- secure plist store -*- lexical-binding: t -*-
-;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2016 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
@@ -126,7 +126,7 @@ symmetric encryption will be used.")
 
 (defun plstore-passphrase-callback-function (_context _key-id plstore)
   (if plstore-cache-passphrase-for-symmetric-encryption
-      (let* ((file (file-truename (plstore--get-buffer plstore)))
+      (let* ((file (file-truename (plstore-get-file plstore)))
             (entry (assoc file plstore-passphrase-alist))
             passphrase)
        (or (copy-sequence (cdr entry))
@@ -270,9 +270,16 @@ symmetric encryption will be used.")
         context
         (cons #'plstore-progress-callback-function
               (format "Decrypting %s" (plstore-get-file plstore))))
-       (setq plain
-             (epg-decrypt-string context
-                                 (plstore--get-encrypted-data plstore)))
+       (condition-case error
+           (setq plain
+                 (epg-decrypt-string context
+                                     (plstore--get-encrypted-data plstore)))
+         (error
+          (let ((entry (assoc (plstore-get-file plstore)
+                              plstore-passphrase-alist)))
+            (if entry
+                (setcdr entry nil)))
+          (signal (car error) (cdr error))))
        (plstore--set-secret-alist plstore (car (read-from-string plain)))
        (plstore--merge-secret plstore)
        (plstore--set-encrypted-data plstore nil))))
@@ -415,7 +422,7 @@ SECRET-KEYS is a plist containing secret data."
              ((listp plstore-encrypt-to) plstore-encrypt-to)
              ((stringp plstore-encrypt-to) (list plstore-encrypt-to))))
            cipher)
-       (epg-context-set-armor context t)
+       (setf (epg-context-armor context) t)
        (epg-context-set-passphrase-callback
         context
         (cons #'plstore-passphrase-callback-function