From a2a5804f19009b4e01acfe3ca481feaa2266cb6d Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 20 Apr 2006 05:41:26 +0000 Subject: [PATCH] Reverted. --- ChangeLog | 2 - epa.el | 5 +- epg.el | 149 +++++++++++++++++++++++++++++++----------------------------- pgg-epg.el | 26 +++++------ 4 files changed, 90 insertions(+), 92 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f1314d..4457242 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,6 @@ 2006-04-20 Daiki Ueno * epa.el (epa-select-keys): Added "Cancel" button. - * epg.el (epg-make-verify-result): Renamed epg-signature to - epg-verify-result. 2006-04-20 Daiki Ueno diff --git a/epa.el b/epa.el index ecabd69..c95480e 100644 --- a/epa.el +++ b/epa.el @@ -443,9 +443,8 @@ (epg-verify-file context file plain) (message "Verifying %s...done" (file-name-nondirectory file)) (message "%s" - (mapconcat #'epg-verify-result-to-string - (reverse (epg-context-result-for context 'verify)) - "\n")))) + (epg-verify-result-to-string + (epg-context-result-for context 'verify))))) (defun epa-sign-file (file detached) (interactive diff --git a/epg.el b/epg.el index 305883e..0c58a54 100644 --- a/epg.el +++ b/epg.el @@ -261,49 +261,49 @@ This function is for internal use only." "Set the result of the previous cryptographic operation." (aset context 12 result)) -(defun epg-make-verify-result (status key-id user-id) - "Return a verify-result object." +(defun epg-make-signature (status key-id user-id) + "Return a signature object." (vector status key-id user-id nil nil)) -(defun epg-verify-result-status (verify-result) - "Return the status code of VERIFY-RESULT." - (aref verify-result 0)) +(defun epg-signature-status (signature) + "Return the status code of SIGNATURE." + (aref signature 0)) -(defun epg-verify-result-key-id (verify-result) - "Return the key-id of VERIFY-RESULT." - (aref verify-result 1)) +(defun epg-signature-key-id (signature) + "Return the key-id of SIGNATURE." + (aref signature 1)) -(defun epg-verify-result-user-id (verify-result) - "Return the user-id of VERIFY-RESULT." - (aref verify-result 2)) +(defun epg-signature-user-id (signature) + "Return the user-id of SIGNATURE." + (aref signature 2)) -(defun epg-verify-result-validity (verify-result) - "Return the validity of VERIFY-RESULT." - (aref verify-result 3)) +(defun epg-signature-validity (signature) + "Return the validity of SIGNATURE." + (aref signature 3)) -(defun epg-verify-result-fingerprint (verify-result) - "Return the fingerprint of VERIFY-RESULT." - (aref verify-result 4)) +(defun epg-signature-fingerprint (signature) + "Return the fingerprint of SIGNATURE." + (aref signature 4)) -(defun epg-verify-result-set-status (verify-result status) - "Set the status code of VERIFY-RESULT." - (aset verify-result 0 status)) +(defun epg-signature-set-status (signature status) + "Set the status code of SIGNATURE." + (aset signature 0 status)) -(defun epg-verify-result-set-key-id (verify-result key-id) - "Set the key-id of VERIFY-RESULT." - (aset verify-result 1 key-id)) +(defun epg-signature-set-key-id (signature key-id) + "Set the key-id of SIGNATURE." + (aset signature 1 key-id)) -(defun epg-verify-result-set-user-id (verify-result user-id) - "Set the user-id of VERIFY-RESULT." - (aset verify-result 2 user-id)) +(defun epg-signature-set-user-id (signature user-id) + "Set the user-id of SIGNATURE." + (aset signature 2 user-id)) -(defun epg-verify-result-set-validity (verify-result validity) - "Set the validity of VERIFY-RESULT." - (aset verify-result 3 validity)) +(defun epg-signature-set-validity (signature validity) + "Set the validity of SIGNATURE." + (aset signature 3 validity)) -(defun epg-verify-result-set-fingerprint (verify-result fingerprint) - "Set the fingerprint of VERIFY-RESULT." - (aset verify-result 4 fingerprint)) +(defun epg-signature-set-fingerprint (signature fingerprint) + "Set the fingerprint of SIGNATURE." + (aset signature 4 fingerprint)) (defun epg-make-key (owner-trust) "Return a key object." @@ -388,13 +388,13 @@ This function is for internal use only." "Return the name of USER-ID." (aref user-id 1)) -(defun epg-user-id-verify-result-list (user-id) - "Return the verify-result list of USER-ID." +(defun epg-user-id-signature-list (user-id) + "Return the signature list of USER-ID." (aref user-id 2)) -(defun epg-user-id-set-verify-result-list (user-id verify-result-list) - "Set the verify-result list of USER-ID." - (aset user-id 2 verify-result-list)) +(defun epg-user-id-set-signature-list (user-id signature-list) + "Set the signature list of USER-ID." + (aset user-id 2 signature-list)) (defun epg-context-result-for (context name) (cdr (assq name (epg-context-result context)))) @@ -406,16 +406,19 @@ This function is for internal use only." (setcdr entry value) (epg-context-set-result context (cons (cons name value) result))))) -(defun epg-verify-result-to-string (verify-result) - (format "%s verify-result from %s %s%s" - (capitalize (symbol-name (epg-verify-result-status verify-result))) - (epg-verify-result-key-id verify-result) - (epg-verify-result-user-id verify-result) - (if (epg-verify-result-validity verify-result) +(defun epg-signature-to-string (signature) + (format "%s signature from %s %s%s" + (capitalize (symbol-name (epg-signature-status signature))) + (epg-signature-key-id signature) + (epg-signature-user-id signature) + (if (epg-signature-validity signature) (format " (trust %s)" - (epg-verify-result-validity verify-result)) + (epg-signature-validity signature)) ""))) +(defun epg-verify-result-to-string (verify-result) + (mapconcat #'epg-signature-to-string (reverse verify-result) "\n")) + (defun epg-start (context args) "Start `epg-gpg-program' in a subprocess with given ARGS." (let* ((args (append (list "--no-tty" @@ -584,7 +587,7 @@ This function is for internal use only." (epg-context-set-result-for epg-context 'verify - (cons (epg-make-verify-result 'good + (cons (epg-make-signature 'good (match-string 1 string) (match-string 2 string)) (epg-context-result-for epg-context 'verify))))) @@ -594,7 +597,7 @@ This function is for internal use only." (epg-context-set-result-for epg-context 'verify - (cons (epg-make-verify-result 'expired + (cons (epg-make-signature 'expired (match-string 1 string) (match-string 2 string)) (epg-context-result-for epg-context 'verify))))) @@ -604,7 +607,7 @@ This function is for internal use only." (epg-context-set-result-for epg-context 'verify - (cons (epg-make-verify-result 'expired-key + (cons (epg-make-signature 'expired-key (match-string 1 string) (match-string 2 string)) (epg-context-result-for epg-context 'verify))))) @@ -614,7 +617,7 @@ This function is for internal use only." (epg-context-set-result-for epg-context 'verify - (cons (epg-make-verify-result 'revoked-key + (cons (epg-make-signature 'revoked-key (match-string 1 string) (match-string 2 string)) (epg-context-result-for epg-context 'verify))))) @@ -624,47 +627,47 @@ This function is for internal use only." (epg-context-set-result-for epg-context 'verify - (cons (epg-make-verify-result 'bad + (cons (epg-make-signature 'bad (match-string 1 string) (match-string 2 string)) (epg-context-result-for epg-context 'verify))))) (defun epg-status-VALIDSIG (process string) - (let ((verify-result (car (epg-context-result-for epg-context 'verify)))) - (if (and verify-result - (eq (epg-verify-result-status verify-result) 'good) + (let ((signature (car (epg-context-result-for epg-context 'verify)))) + (if (and signature + (eq (epg-signature-status signature) 'good) (string-match "\\`\\([^ ]+\\) " string)) - (epg-verify-result-set-fingerprint verify-result (match-string 1 string))))) + (epg-signature-set-fingerprint signature (match-string 1 string))))) (defun epg-status-TRUST_UNDEFINED (process string) - (let ((verify-result (car (epg-context-result-for epg-context 'verify)))) - (if (and verify-result - (eq (epg-verify-result-status verify-result) 'good)) - (epg-verify-result-set-validity verify-result 'undefined)))) + (let ((signature (car (epg-context-result-for epg-context 'verify)))) + (if (and signature + (eq (epg-signature-status signature) 'good)) + (epg-signature-set-validity signature 'undefined)))) (defun epg-status-TRUST_NEVER (process string) - (let ((verify-result (car (epg-context-result-for epg-context 'verify)))) - (if (and verify-result - (eq (epg-verify-result-status verify-result) 'good)) - (epg-verify-result-set-validity verify-result 'never)))) + (let ((signature (car (epg-context-result-for epg-context 'verify)))) + (if (and signature + (eq (epg-signature-status signature) 'good)) + (epg-signature-set-validity signature 'never)))) (defun epg-status-TRUST_MARGINAL (process string) - (let ((verify-result (car (epg-context-result-for epg-context 'verify)))) - (if (and verify-result - (eq (epg-verify-result-status verify-result) 'marginal)) - (epg-verify-result-set-validity verify-result 'marginal)))) + (let ((signature (car (epg-context-result-for epg-context 'verify)))) + (if (and signature + (eq (epg-signature-status signature) 'marginal)) + (epg-signature-set-validity signature 'marginal)))) (defun epg-status-TRUST_FULLY (process string) - (let ((verify-result (car (epg-context-result-for epg-context 'verify)))) - (if (and verify-result - (eq (epg-verify-result-status verify-result) 'good)) - (epg-verify-result-set-validity verify-result 'full)))) + (let ((signature (car (epg-context-result-for epg-context 'verify)))) + (if (and signature + (eq (epg-signature-status signature) 'good)) + (epg-signature-set-validity signature 'full)))) (defun epg-status-TRUST_ULTIMATE (process string) - (let ((verify-result (car (epg-context-result-for epg-context 'verify)))) - (if (and verify-result - (eq (epg-verify-result-status verify-result) 'good)) - (epg-verify-result-set-validity verify-result 'ultimate)))) + (let ((signature (car (epg-context-result-for epg-context 'verify)))) + (if (and signature + (eq (epg-signature-status signature) 'good)) + (epg-signature-set-validity signature 'ultimate)))) (defun epg-status-PROGRESS (process string) (if (string-match "\\`\\([^ ]+\\) \\([^ ]\\) \\([0-9]+\\) \\([0-9]+\\)" diff --git a/pgg-epg.el b/pgg-epg.el index 6153f0b..bc093bb 100644 --- a/pgg-epg.el +++ b/pgg-epg.el @@ -100,14 +100,13 @@ passphrase cache or user." (insert signature)) t)) -(defvar pgg-epg-verify-results nil) +(defvar pgg-epg-signatures nil) (defun pgg-epg-verify-region (start end &optional signature) "This function is for internal use only. Verify region between START and END as the detached signature SIGNATURE." - (let ((context (epg-make-context)) - verify-results) + (let ((context (epg-make-context))) (epg-context-set-armor context t) (epg-context-set-textmode context pgg-text-mode) (if signature @@ -117,13 +116,12 @@ Verify region between START and END as the detached signature SIGNATURE." (buffer-string)) (buffer-substring start end)) (epg-verify-string context (buffer-substring start end))) - (setq verify-results (reverse (epg-context-result-for context 'verify))) (save-excursion (set-buffer (get-buffer-create pgg-errors-buffer)) - (make-local-variable 'pgg-epg-verify-results) - (setq pgg-epg-verify-results (car verify-results)) + (make-local-variable 'pgg-epg-signatures) + (setq pgg-epg-signatures (epg-context-result-for context 'verify)) (erase-buffer) - (insert (mapconcat #'epg-verify-result-to-string verify-results "\n"))) + (insert (epg-verify-result-to-string pgg-epg-signatures))) t)) (defun pgg-epg-insert-key () @@ -146,15 +144,15 @@ Add all public keys in region between START and END to the keyring." (epg-context-set-textmode context pgg-text-mode) (epg-import-keys context (buffer-substring start end)))) -(defun mml2015-gpg-extract-verify-result-details () - (if pgg-epg-verify-result - (let* ((expired (eq (epg-verify-result-status pgg-epg-verify-result) +(defun mml2015-gpg-extract-signature-details () + (if pgg-epg-signature + (let* ((expired (eq (epg-signature-status pgg-epg-signature) 'key-expired)) - (signer (cons (epg-verify-result-key-id pgg-epg-verify-result) - (epg-verify-result-user-id pgg-epg-verify-result))) - (fprint (epg-verify-result-fingerprint pgg-epg-verify-result)) + (signer (cons (epg-signature-key-id pgg-epg-signature) + (epg-signature-user-id pgg-epg-signature))) + (fprint (epg-signature-fingerprint pgg-epg-signature)) (trust-good-enough-p - (memq (epg-verify-result-validity pgg-epg-verify-result) + (memq (epg-signature-validity pgg-epg-signature) '(marginal fully ultimate)))) (cond ((and signer fprint) (concat (cdr signer) -- 1.7.10.4