From: ueno Date: Sat, 11 Nov 2006 08:53:35 +0000 (+0000) Subject: (epg--status-NOTATION_NAME): New function. X-Git-Tag: epg-0_0_8~36 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=8335b14c224a471662db08aea206666c26147bf8;p=elisp%2Fepg.git (epg--status-NOTATION_NAME): New function. (epg--status-NOTATION_DATA): New function. (epg--status-POLICY_URL): New function. (epg-make-signature): New slot "notations". --- diff --git a/ChangeLog b/ChangeLog index aec2184..70439b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,11 +2,15 @@ * epg.el (epg-start-sign): Don't set --armor nor --textmode if mode is set for a cleartext signature. - (epg-make-context): New slot "signature-notations". - (epg--args-from-signature-notations): New function. + (epg-make-context): New slot "sig-notations". + (epg--args-from-sig-notations): New function. (epg-start-sign): Specify --sig-notation or --sig-policy-url if desired. (epg-start-encrypt): Ditto. + (epg--status-NOTATION_NAME): New function. + (epg--status-NOTATION_DATA): New function. + (epg--status-POLICY_URL): New function. + (epg-make-signature): New slot "notations". 2006-10-29 Daiki Ueno diff --git a/epg.el b/epg.el index add41e1..7f15680 100644 --- a/epg.el +++ b/epg.el @@ -250,7 +250,7 @@ message." (signal 'wrong-type-argument (list 'epg-context-p context))) (aref (cdr context) 9)) -(defun epg-context-signature-notations (context) +(defun epg-context-sig-notations (context) "Return the list of notations for singning." (unless (eq (car-safe context) 'epg-context) (signal 'wrong-type-argument (list 'epg-context-p context))) @@ -343,7 +343,7 @@ This function is for internal use only." (signal 'wrong-type-argument (list 'epg-context-p context))) (aset (cdr context) 9 signers)) -(defun epg-context-set-signature-notations (context notations) +(defun epg-context-set-sig-notations (context notations) "Set the list of notations for singning." (unless (eq (car-safe context) 'epg-context) (signal 'wrong-type-argument (list 'epg-context-p context))) @@ -377,7 +377,8 @@ This function is for internal use only." (defun epg-make-signature (status &optional key-id) "Return a signature object." - (cons 'epg-signature (vector status key-id nil nil nil nil nil nil nil nil))) + (cons 'epg-signature (vector status key-id nil nil nil nil nil nil nil nil + nil))) (defun epg-signature-status (signature) "Return the status code of SIGNATURE." @@ -439,6 +440,12 @@ This function is for internal use only." (signal 'wrong-type-argument (list 'epg-signature-p signature))) (aref (cdr signature) 9)) +(defun epg-signature-notations (signature) + "Return the list of notations of SIGNATURE." + (unless (eq (car-safe signature) 'epg-signature) + (signal 'wrong-type-argument (list 'epg-signature-p signature))) + (aref (cdr signature) 10)) + (defun epg-signature-set-status (signature status) "Set the status code of SIGNATURE." (unless (eq (car-safe signature) 'epg-signature) @@ -499,6 +506,12 @@ This function is for internal use only." (signal 'wrong-type-argument (list 'epg-signature-p signature))) (aset (cdr signature) 9 version)) +(defun epg-signature-set-notations (signature notations) + "Set the list of notations of SIGNATURE." + (unless (eq (car-safe signature) 'epg-signature) + (signal 'wrong-type-argument (list 'epg-signature-p signature))) + (aset (cdr signature) 10 notations)) + (defun epg-make-new-signature (type pubkey-algorithm digest-algorithm class creation-time fingerprint) "Return a new signature object." @@ -727,38 +740,45 @@ This function is for internal use only." (signal 'wrong-type-argument (list 'epg-key-signature-p key-signature))) (aref (cdr key-signature) 7)) -(defun epg-make-signature-notation (name value &optional human-readable +(defun epg-make-sig-notation (name value &optional human-readable critical) "Return a notation object." - (cons 'epg-signature-notation (vector name value human-readable critical))) - -(defun epg-signature-notation-name (signature-notation) - "Return the name of SIGNATURE-NOTATION." - (unless (eq (car-safe signature-notation) 'epg-signature-notation) - (signal 'wrong-type-argument (list 'epg-signature-notation-p - signature-notation))) - (aref (cdr signature-notation) 0)) - -(defun epg-signature-notation-value (signature-notation) - "Return the value of SIGNATURE-NOTATION." - (unless (eq (car-safe signature-notation) 'epg-signature-notation) - (signal 'wrong-type-argument (list 'epg-signature-notation-p - signature-notation))) - (aref (cdr signature-notation) 1)) - -(defun epg-signature-notation-human-readable (signature-notation) - "Return the human-readable of SIGNATURE-NOTATION." - (unless (eq (car-safe signature-notation) 'epg-signature-notation) - (signal 'wrong-type-argument (list 'epg-signature-notation-p - signature-notation))) - (aref (cdr signature-notation) 2)) - -(defun epg-signature-notation-critical (signature-notation) - "Return the critical of SIGNATURE-NOTATION." - (unless (eq (car-safe signature-notation) 'epg-signature-notation) - (signal 'wrong-type-argument (list 'epg-signature-notation-p - signature-notation))) - (aref (cdr signature-notation) 3)) + (cons 'epg-sig-notation (vector name value human-readable critical))) + +(defun epg-sig-notation-name (sig-notation) + "Return the name of SIG-NOTATION." + (unless (eq (car-safe sig-notation) 'epg-sig-notation) + (signal 'wrong-type-argument (list 'epg-sig-notation-p + sig-notation))) + (aref (cdr sig-notation) 0)) + +(defun epg-sig-notation-value (sig-notation) + "Return the value of SIG-NOTATION." + (unless (eq (car-safe sig-notation) 'epg-sig-notation) + (signal 'wrong-type-argument (list 'epg-sig-notation-p + sig-notation))) + (aref (cdr sig-notation) 1)) + +(defun epg-sig-notation-human-readable (sig-notation) + "Return the human-readable of SIG-NOTATION." + (unless (eq (car-safe sig-notation) 'epg-sig-notation) + (signal 'wrong-type-argument (list 'epg-sig-notation-p + sig-notation))) + (aref (cdr sig-notation) 2)) + +(defun epg-sig-notation-critical (sig-notation) + "Return the critical of SIG-NOTATION." + (unless (eq (car-safe sig-notation) 'epg-sig-notation) + (signal 'wrong-type-argument (list 'epg-sig-notation-p + sig-notation))) + (aref (cdr sig-notation) 3)) + +(defun epg-sig-notation-set-value (sig-notation value) + "Set the value of SIG-NOTATION." + (unless (eq (car-safe sig-notation) 'epg-sig-notation) + (signal 'wrong-type-argument (list 'epg-sig-notation-p + sig-notation))) + (aset (cdr sig-notation) 1 value)) (defun epg-context-result-for (context name) "Return the result of CONTEXT associated with NAME." @@ -1193,6 +1213,29 @@ This function is for internal use only." (eq (epg-signature-status signature) 'good)) (epg-signature-set-validity signature 'ultimate)))) +(defun epg--status-NOTATION_NAME (context string) + (let ((signature (car (epg-context-result-for context 'verify)))) + (if signature + (epg-signature-set-notations + signature + (cons (epg-make-sig-notation string nil t nil) + (epg-sig-notations signature)))))) + +(defun epg--status-NOTATION_DATA (context string) + (let ((signature (car (epg-context-result-for context 'verify))) + notation) + (if (and signature + (setq notation (car (epg-sig-notations signature)))) + (epg-sig-notation-set-value notation string)))) + +(defun epg--status-POLICY_URL (context string) + (let ((signature (car (epg-context-result-for context 'verify)))) + (if signature + (epg-signature-set-notations + signature + (cons (epg-make-sig-notation nil string t nil) + (epg-sig-notations signature)))))) + (defun epg--status-PROGRESS (context string) (if (string-match "\\`\\([^ ]+\\) \\([^ ]\\) \\([0-9]+\\) \\([0-9]+\\)" string) @@ -1539,23 +1582,25 @@ You can then use `write-region' to write new data into the file." (defun epg--clear-string (string) (fillarray string 0))) -(defun epg--args-from-signature-notations (notations) +(defun epg--args-from-sig-notations (notations) (apply #'nconc (mapcar (lambda (notation) - (if (and (epg-signature-notation-name notation) - (not (epg-signature-notation-human-readable notation))) + (if (and (epg-sig-notation-name notation) + (not (epg-sig-notation-human-readable notation))) (error "Unreadable")) - (if (epg-signature-notation-name notation) + (if (epg-sig-notation-name notation) (list "--sig-notation" - (if (epg-signature-notation-critical notation) - (concat "!" (epg-signature-notation-name notation) - "=" (epg-signature-notation-value notation)) - (concat (epg-signature-notation-name notation) - "=" (epg-signature-notation-value notation)))) + (if (epg-sig-notation-critical notation) + (concat "!" (epg-sig-notation-name notation) + "=" (epg-sig-notation-value notation)) + (concat (epg-sig-notation-name notation) + "=" (epg-sig-notation-value notation)))) (list "--sig-policy-url" - (epg-signature-notation-value notation)))) - notations)) + (if (epg-sig-notation-critical notation) + (concat "!" (epg-sig-notation-value notation)) + (epg-sig-notation-value notation)))) + notations)) ;;;###autoload (defun epg-cancel (context) @@ -1758,8 +1803,8 @@ If you are unsure, use synchronous version of this function (epg-sub-key-id (car (epg-key-sub-key-list signer))))) (epg-context-signers context))) - (epg--args-from-signature-notations - (epg-context-signature-notations context)) + (epg--args-from-sig-notations + (epg-context-sig-notations context)) (if (epg-data-file plain) (list "--" (epg-data-file plain))))) ;; `gpgsm' does not read passphrase from stdin, so waiting is not needed. @@ -1847,8 +1892,8 @@ If you are unsure, use synchronous version of this function signer))))) (epg-context-signers context)))) (if sign - (epg--args-from-signature-notations - (epg-context-signature-notations context))) + (epg--args-from-sig-notations + (epg-context-sig-notations context))) (apply #'nconc (mapcar (lambda (recipient)