]> git.eshelyaron.com Git - emacs.git/commitdiff
(epg-make-context, epg-context-set-passphrase-callback)
authorDaiki Ueno <ueno@unixuser.org>
Thu, 21 Aug 2008 03:45:14 +0000 (03:45 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Thu, 21 Aug 2008 03:45:14 +0000 (03:45 +0000)
(epg-context-set-progress-callback): Make sure the callback is a
cons of a function and a handback.  Update all callers.

lisp/ChangeLog
lisp/epg.el

index ef23d308cc3ab0a796abf027873f6246fdf86eef..4c736754a6e0542491cb55979a298dbb1e9a07a3 100644 (file)
@@ -1,3 +1,9 @@
+2008-08-21  Daiki Ueno  <ueno@unixuser.org>
+
+       * epg.el (epg-make-context, epg-context-set-passphrase-callback)
+       (epg-context-set-progress-callback): Make sure the callback is a
+       cons of a function and a handback.  Update all callers.
+
 2008-08-20  David Reitter  <david.reitter@gmail.com>
 
        * term/ns-win.el (ns-cursor-blink-rate, ns-cursor-blink-mode): Remove.
index b7d973266f6e0d9cfd47c0b21281c4701b249a93..7ad0d34b4b0ac757ed4683baa4e70d4880654130 100644 (file)
   (cons 'epg-context
        (vector (or protocol 'OpenPGP) armor textmode include-certs
                cipher-algorithm digest-algorithm compress-algorithm
-               #'epg-passphrase-callback-function
+               (list #'epg-passphrase-callback-function)
                nil
                nil nil nil nil nil nil)))
 
@@ -328,7 +328,9 @@ This function is for internal use only."
   "Set the function used to query passphrase."
   (unless (eq (car-safe context) 'epg-context)
     (signal 'wrong-type-argument (list 'epg-context-p context)))
-  (aset (cdr context) 7 passphrase-callback))
+  (aset (cdr context) 7 (if (consp passphrase-callback)
+                           passphrase-callback
+                         (list passphrase-callback))))
 
 (defun epg-context-set-progress-callback (context
                                          progress-callback)
@@ -336,7 +338,9 @@ This function is for internal use only."
 If optional argument HANDBACK is specified, it is passed to PROGRESS-CALLBACK."
   (unless (eq (car-safe context) 'epg-context)
     (signal 'wrong-type-argument (list 'epg-context-p context)))
-  (aset (cdr context) 8 progress-callback))
+  (aset (cdr context) 8 (if (consp progress-callback)
+                           progress-callback
+                         (list progress-callback))))
 
 (defun epg-context-set-signers (context signers)
   "Set the list of key-id for signing."
@@ -1239,13 +1243,10 @@ This function is for internal use only."
              (progn
                (setq passphrase
                      (funcall
-                      (if (consp (epg-context-passphrase-callback context))
-                          (car (epg-context-passphrase-callback context))
-                        (epg-context-passphrase-callback context))
+                      (car (epg-context-passphrase-callback context))
                       context
                       epg-key-id
-                      (if (consp (epg-context-passphrase-callback context))
-                          (cdr (epg-context-passphrase-callback context)))))
+                      (cdr (epg-context-passphrase-callback context))))
                (when passphrase
                  (setq passphrase-with-new-line (concat passphrase "\n"))
                  (epg--clear-string passphrase)
@@ -1493,16 +1494,13 @@ This function is for internal use only."
   (if (and (epg-context-progress-callback context)
           (string-match "\\`\\([^ ]+\\) \\([^ ]\\) \\([0-9]+\\) \\([0-9]+\\)"
                         string))
-      (funcall (if (consp (epg-context-progress-callback context))
-                  (car (epg-context-progress-callback context))
-                (epg-context-progress-callback context))
+      (funcall (car (epg-context-progress-callback context))
               context
               (match-string 1 string)
               (match-string 2 string)
               (string-to-number (match-string 3 string))
               (string-to-number (match-string 4 string))
-              (if (consp (epg-context-progress-callback context))
-                  (cdr (epg-context-progress-callback context))))))
+              (cdr (epg-context-progress-callback context)))))
 
 (defun epg--status-ENC_TO (context string)
   (if (string-match "\\`\\([0-9A-Za-z]+\\) \\([0-9]+\\) \\([0-9]+\\)" string)