From 95400bab17e837517d55afccd704aafd57d8706b Mon Sep 17 00:00:00 2001 From: ueno Date: Wed, 12 Apr 2006 09:11:26 +0000 Subject: [PATCH] * epg.el (epg-reset): Don't reset result. (epg-start-decrypt): Reset result before epg-start. (epg-start-verify): Ditto. (epg-start-sign): Ditto. (epg-start-encrypt): Ditto. (epg-start-export-keys): Ditto. (epg-start-import-keys): Ditto. --- ChangeLog | 8 ++++++++ epg.el | 35 ++++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c7116f..6ca9f61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2006-04-12 Daiki Ueno + * epg.el (epg-reset): Don't reset result. + (epg-start-decrypt): Reset result before epg-start. + (epg-start-verify): Ditto. + (epg-start-sign): Ditto. + (epg-start-encrypt): Ditto. + (epg-start-export-keys): Ditto. + (epg-start-import-keys): Ditto. + * Makefile.am (EXTRA_DIST): Added pgg-epg.el. * pgg-epg.el: New file. diff --git a/epg.el b/epg.el index 32ba4a6..662ffe9 100644 --- a/epg.el +++ b/epg.el @@ -290,8 +290,7 @@ This function is for internal use only." (kill-buffer (process-buffer (epg-context-process context)))) (epg-context-set-process context nil) (if (file-exists-p (epg-context-output-file context)) - (delete-file (epg-context-output-file context))) - (aset context 9 nil)) + (delete-file (epg-context-output-file context)))) (defun epg-status-USERID_HINT (process string) (if (string-match "\\`\\([^ ]+\\) \\(.*\\)" string) @@ -580,6 +579,7 @@ If you use this function, you will need to wait for the completion of `epg-reset' to clear a temporaly output file. If you are unsure, use synchronous version of this function `epg-decrypt-string' instead." + (epg-context-set-result context nil) (epg-context-set-output-file context (epg-make-temp-file "epg-output")) (epg-start context (list "--decrypt" input-file)) @@ -621,6 +621,7 @@ If you use this function, you will need to wait for the completion of `epg-reset' to clear a temporaly output file. If you are unsure, use synchronous version of this function `epg-verify-string' instead." + (epg-context-set-result context nil) (epg-context-set-output-file context (epg-make-temp-file "epg-output")) (if string ;; Detached signature. @@ -636,6 +637,19 @@ If you are unsure, use synchronous version of this function (process-send-string (epg-context-process context) signature)))) ;;;###autoload +(defun epg-verify-file (context input-file &optional string) + "Verify INPUT-FILE. + +For a detached signature, both INPUT-FILE and STRING should be string. +For a normal or a clear text signature, STRING should be nil." + (unwind-protect + (progn + (epg-start-verify context input-file string) + (epg-wait-for-completion context) + (epg-context-result-for context 'verify)) + (epg-reset context))) + +;;;###autoload (defun epg-verify-string (context signature &optional string) "Verify SIGNATURE. @@ -652,19 +666,6 @@ For a normal or a clear text signature, STRING should be nil." (delete-file input-file))))) ;;;###autoload -(defun epg-verify-file (context input-file &optional string) - "Verify INPUT-FILE. - -For a detached signature, both INPUT-FILE and STRING should be string. -For a normal or a clear text signature, STRING should be nil." - (unwind-protect - (progn - (epg-start-verify context input-file string) - (epg-wait-for-completion context) - (epg-context-result-for context 'verify)) - (epg-reset context))) - -;;;###autoload (defun epg-start-sign (context string &optional mode) "Initiate a sign operation on STRING. @@ -677,6 +678,7 @@ If you use this function, you will need to wait for the completion of `epg-reset' to clear a temporaly output file. If you are unsure, use synchronous version of this function `epg-sign-string' instead." + (epg-context-set-result context nil) (epg-context-set-output-file context (epg-make-temp-file "epg-output")) (epg-start context (append (list (if (eq mode 'clearsign) @@ -718,6 +720,7 @@ If you use this function, you will need to wait for the completion of `epg-reset' to clear a temporaly output file. If you are unsure, use synchronous version of this function `epg-encrypt-string' instead." + (epg-context-set-result context nil) (epg-context-set-output-file context (epg-make-temp-file "epg-output")) (epg-start context (append (if always-trust '("--always-trust")) @@ -762,6 +765,7 @@ If you use this function, you will need to wait for the completion of `epg-reset' to clear a temporaly output file. If you are unsure, use synchronous version of this function `epg-export-keys' instead." + (epg-context-set-result context nil) (epg-context-set-output-file context (epg-make-temp-file "epg-output")) (epg-start context (list "--export" pattern))) @@ -786,6 +790,7 @@ If you use this function, you will need to wait for the completion of `epg-reset' to clear a temporaly output file. If you are unsure, use synchronous version of this function `epg-import-keys' instead." + (epg-context-set-result context nil) (epg-context-set-output-file context (epg-make-temp-file "epg-output")) (epg-start context (list "--import")) (if (eq (process-status (epg-context-process context)) 'run) -- 1.7.10.4