From: ueno Date: Thu, 20 Apr 2006 05:25:45 +0000 (+0000) Subject: * epa.el (epa-select-keys): Added "Cancel" button. X-Git-Tag: epgsm-branchpoint~18 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=0aaa0d9d521bd62d32cf5b4f2a1d56a901804a76;p=elisp%2Fepg.git * epa.el (epa-select-keys): Added "Cancel" button. * epg.el (epg-make-verify-result): Renamed epg-signature to epg-verify-result. --- diff --git a/ChangeLog b/ChangeLog index d8e1507..9f1314d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 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 + * epg.el (epg-signature-to-string): New function. 2006-04-20 Daiki Ueno diff --git a/epa.el b/epa.el index 6549e40..ea1f27c 100644 --- a/epa.el +++ b/epa.el @@ -302,6 +302,12 @@ (erase-buffer) (insert prompt "\n") (widget-create 'link + :notify (lambda (&rest ignore) (abort-recursive-edit)) + :help-echo + (substitute-command-keys + "Click here or \\[abort-recursive-edit] to cancel") + "Cancel") + (widget-create 'link :notify (lambda (&rest ignore) (exit-recursive-edit)) :help-echo (substitute-command-keys @@ -438,7 +444,7 @@ (epg-verify-file context file plain) (message "Verifying %s...done" (file-name-nondirectory file)) (message "%s" - (mapconcat #'epg-signature-to-string + (mapconcat #'epg-verify-result-to-string (reverse (epg-context-result-for context 'verify)) "\n")))) diff --git a/epg.el b/epg.el index 486ab79..305883e 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-signature (status key-id user-id) - "Return a signature object." +(defun epg-make-verify-result (status key-id user-id) + "Return a verify-result object." (vector status key-id user-id nil nil)) -(defun epg-signature-status (signature) - "Return the status code of SIGNATURE." - (aref signature 0)) +(defun epg-verify-result-status (verify-result) + "Return the status code of VERIFY-RESULT." + (aref verify-result 0)) -(defun epg-signature-key-id (signature) - "Return the key-id of SIGNATURE." - (aref signature 1)) +(defun epg-verify-result-key-id (verify-result) + "Return the key-id of VERIFY-RESULT." + (aref verify-result 1)) -(defun epg-signature-user-id (signature) - "Return the user-id of SIGNATURE." - (aref signature 2)) +(defun epg-verify-result-user-id (verify-result) + "Return the user-id of VERIFY-RESULT." + (aref verify-result 2)) -(defun epg-signature-validity (signature) - "Return the validity of SIGNATURE." - (aref signature 3)) +(defun epg-verify-result-validity (verify-result) + "Return the validity of VERIFY-RESULT." + (aref verify-result 3)) -(defun epg-signature-fingerprint (signature) - "Return the fingerprint of SIGNATURE." - (aref signature 4)) +(defun epg-verify-result-fingerprint (verify-result) + "Return the fingerprint of VERIFY-RESULT." + (aref verify-result 4)) -(defun epg-signature-set-status (signature status) - "Set the status code of SIGNATURE." - (aset signature 0 status)) +(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-key-id (signature key-id) - "Set the key-id of SIGNATURE." - (aset signature 1 key-id)) +(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-user-id (signature user-id) - "Set the user-id of SIGNATURE." - (aset signature 2 user-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-validity (signature validity) - "Set the validity of SIGNATURE." - (aset signature 3 validity)) +(defun epg-verify-result-set-validity (verify-result validity) + "Set the validity of VERIFY-RESULT." + (aset verify-result 3 validity)) -(defun epg-signature-set-fingerprint (signature fingerprint) - "Set the fingerprint of SIGNATURE." - (aset signature 4 fingerprint)) +(defun epg-verify-result-set-fingerprint (verify-result fingerprint) + "Set the fingerprint of VERIFY-RESULT." + (aset verify-result 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-signature-list (user-id) - "Return the signature list of USER-ID." +(defun epg-user-id-verify-result-list (user-id) + "Return the verify-result list of USER-ID." (aref user-id 2)) -(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-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-context-result-for (context name) (cdr (assq name (epg-context-result context)))) @@ -406,14 +406,14 @@ This function is for internal use only." (setcdr entry value) (epg-context-set-result context (cons (cons name value) 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) +(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) (format " (trust %s)" - (epg-signature-validity signature)) + (epg-verify-result-validity verify-result)) ""))) (defun epg-start (context args) @@ -584,7 +584,7 @@ This function is for internal use only." (epg-context-set-result-for epg-context 'verify - (cons (epg-make-signature 'good + (cons (epg-make-verify-result 'good (match-string 1 string) (match-string 2 string)) (epg-context-result-for epg-context 'verify))))) @@ -594,7 +594,7 @@ This function is for internal use only." (epg-context-set-result-for epg-context 'verify - (cons (epg-make-signature 'expired + (cons (epg-make-verify-result 'expired (match-string 1 string) (match-string 2 string)) (epg-context-result-for epg-context 'verify))))) @@ -604,7 +604,7 @@ This function is for internal use only." (epg-context-set-result-for epg-context 'verify - (cons (epg-make-signature 'expired-key + (cons (epg-make-verify-result 'expired-key (match-string 1 string) (match-string 2 string)) (epg-context-result-for epg-context 'verify))))) @@ -614,7 +614,7 @@ This function is for internal use only." (epg-context-set-result-for epg-context 'verify - (cons (epg-make-signature 'revoked-key + (cons (epg-make-verify-result 'revoked-key (match-string 1 string) (match-string 2 string)) (epg-context-result-for epg-context 'verify))))) @@ -624,47 +624,47 @@ This function is for internal use only." (epg-context-set-result-for epg-context 'verify - (cons (epg-make-signature 'bad + (cons (epg-make-verify-result 'bad (match-string 1 string) (match-string 2 string)) (epg-context-result-for epg-context 'verify))))) (defun epg-status-VALIDSIG (process string) - (let ((signature (car (epg-context-result-for epg-context 'verify)))) - (if (and signature - (eq (epg-signature-status signature) 'good) + (let ((verify-result (car (epg-context-result-for epg-context 'verify)))) + (if (and verify-result + (eq (epg-verify-result-status verify-result) 'good) (string-match "\\`\\([^ ]+\\) " string)) - (epg-signature-set-fingerprint signature (match-string 1 string))))) + (epg-verify-result-set-fingerprint verify-result (match-string 1 string))))) (defun epg-status-TRUST_UNDEFINED (process string) - (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)))) + (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)))) (defun epg-status-TRUST_NEVER (process string) - (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)))) + (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)))) (defun epg-status-TRUST_MARGINAL (process string) - (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)))) + (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)))) (defun epg-status-TRUST_FULLY (process string) - (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)))) + (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)))) (defun epg-status-TRUST_ULTIMATE (process string) - (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)))) + (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)))) (defun epg-status-PROGRESS (process string) (if (string-match "\\`\\([^ ]+\\) \\([^ ]\\) \\([0-9]+\\) \\([0-9]+\\)" diff --git a/pgg-epg.el b/pgg-epg.el index eb84a96..6153f0b 100644 --- a/pgg-epg.el +++ b/pgg-epg.el @@ -100,14 +100,14 @@ passphrase cache or user." (insert signature)) t)) -(defvar pgg-epg-signature nil) +(defvar pgg-epg-verify-results 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)) - pointer) + verify-results) (epg-context-set-armor context t) (epg-context-set-textmode context pgg-text-mode) (if signature @@ -117,21 +117,14 @@ 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 signature (reverse (epg-context-result-for context 'verify)) - pointer signature) + (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-signature) - (setq pgg-epg-signature (car signature)) + (make-local-variable 'pgg-epg-verify-results) + (setq pgg-epg-verify-results (car verify-results)) (erase-buffer) - (while pointer - (insert (format "%s: %s %s %s\n" - (epg-signature-status (car pointer)) - (epg-signature-key-id (car pointer)) - (epg-signature-user-id (car pointer)) - (epg-signature-validity (car pointer)))) - (setq pointer (cdr pointer)))) - signature)) + (insert (mapconcat #'epg-verify-result-to-string verify-results "\n"))) + t)) (defun pgg-epg-insert-key () "This function is for internal use only. @@ -153,15 +146,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-signature-details () - (if pgg-epg-signature - (let* ((expired (eq (epg-signature-status pgg-epg-signature) +(defun mml2015-gpg-extract-verify-result-details () + (if pgg-epg-verify-result + (let* ((expired (eq (epg-verify-result-status pgg-epg-verify-result) 'key-expired)) - (signer (cons (epg-signature-key-id pgg-epg-signature) - (epg-signature-user-id pgg-epg-signature))) - (fprint (epg-signature-fingerprint pgg-epg-signature)) + (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)) (trust-good-enough-p - (memq (epg-signature-validity pgg-epg-signature) + (memq (epg-verify-result-validity pgg-epg-verify-result) '(marginal fully ultimate)))) (cond ((and signer fprint) (concat (cdr signer)