Commit f1c9aabc authored by Daiki Ueno's avatar Daiki Ueno
Browse files

Move photo ID display code from epg.el to gnus/mml2015.el.

2012-12-26  Daiki Ueno  <ueno@gnu.org>
* mml2015.el (mml2015-epg-signature-to-string): New function.
(mml2015-epg-verify-result-to-string): New function.
(mml2015-epg-decrypt, mml2015-epg-clear-decrypt, mml2015-epg-verify)
(mml2015-epg-clear-verify): Use mml2015-epg-verify-result-to-string
instead of epg-verify-result-to-string.
(epg-signature-key-id, epg-signature-to-string): Autoload.
(epg-verify-result-to-string): Remove autoload.

2012-12-25  Adam Sjøgren  <asjo@koldfront.dk>
* mml2015.el (mml2015-epg-key-image): New function, to retrieve photo
ID image from GPG public key.
(mml2015-epg-key-image-to-string): New function.
parent 12384b01
2012-12-25 Adam Sjøgren <asjo@koldfront.dk>
* epg.el (epg-signature-to-string): Use new functions
epg-key-image, epg-key-image-to-string to find and display image
from key.
2012-12-24 Constantin Kulikov <zxnotdead@gmail.com> (tiny change)
 
* startup.el (initial-buffer-choice): Allow function as value
......
......@@ -967,34 +967,12 @@ This function is for internal use only."
(setcdr entry value)
(epg-context-set-result context (cons (cons name value) result)))))
(defun epg-key-image (key-id)
"Return the image of a key, if any"
(let ((filename
(replace-regexp-in-string
"\n" ""
(shell-command-to-string
(concat "/usr/bin/gpg --photo-viewer 'echo %I >&2' --list-keys "
key-id " > /dev/null")))))
(when (and (not (string-equal filename ""))
(file-exists-p filename))
(create-image filename))))
(defun epg-key-image-to-string (key-id)
"Return a string with the image of a key, if any"
(let* ((result "")
(key-image (epg-key-image key-id)))
(when key-image
(setq result " ")
(put-text-property 1 2 'display key-image result))
result))
(defun epg-signature-to-string (signature)
"Convert SIGNATURE to a human readable string."
(let* ((user-id (cdr (assoc (epg-signature-key-id signature)
epg-user-id-alist)))
(pubkey-algorithm (epg-signature-pubkey-algorithm signature))
(key-id (epg-signature-key-id signature))
(key-image (epg-key-image-to-string key-id)))
(key-id (epg-signature-key-id signature)))
(concat
(cond ((eq (epg-signature-status signature) 'good)
"Good signature from ")
......@@ -1009,7 +987,6 @@ This function is for internal use only."
((eq (epg-signature-status signature) 'no-pubkey)
"No public key for "))
key-id
key-image
(if user-id
(concat " "
(if (stringp user-id)
......
2012-12-26 Daiki Ueno <ueno@gnu.org>
* mml2015.el (mml2015-epg-signature-to-string): New function.
(mml2015-epg-verify-result-to-string): New function.
(mml2015-epg-decrypt, mml2015-epg-clear-decrypt, mml2015-epg-verify)
(mml2015-epg-clear-verify): Use mml2015-epg-verify-result-to-string
instead of epg-verify-result-to-string.
(epg-signature-key-id, epg-signature-to-string): Autoload.
(epg-verify-result-to-string): Remove autoload.
2012-12-25 Adam Sjøgren <asjo@koldfront.dk>
* mml2015.el (mml2015-epg-key-image): New function, to retrieve photo
ID image from GPG public key.
(mml2015-epg-key-image-to-string): New function.
2012-12-25 Leo Liu <sdl.web@gmail.com>
 
* plstore.el (plstore-passphrase-callback-function): Fix error when
......
......@@ -735,6 +735,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
(defvar epg-user-id-alist)
(defvar epg-digest-algorithm-alist)
(defvar epg-gpg-program)
(defvar inhibit-redisplay)
(autoload 'epg-make-context "epg")
......@@ -743,7 +744,6 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
(autoload 'epg-context-set-signers "epg")
(autoload 'epg-context-result-for "epg")
(autoload 'epg-new-signature-digest-algorithm "epg")
(autoload 'epg-verify-result-to-string "epg")
(autoload 'epg-list-keys "epg")
(autoload 'epg-decrypt-string "epg")
(autoload 'epg-verify-string "epg")
......@@ -755,6 +755,8 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
(autoload 'epg-sub-key-capability "epg")
(autoload 'epg-sub-key-validity "epg")
(autoload 'epg-sub-key-fingerprint "epg")
(autoload 'epg-signature-key-id "epg")
(autoload 'epg-signature-to-string "epg")
(autoload 'epg-configuration "epg-config")
(autoload 'epg-expand-group "epg-config")
(autoload 'epa-select-keys "epa")
......@@ -818,6 +820,34 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
(setq secret-keys (cdr secret-keys))))
secret-key))
(defun mml2015-epg-key-image (key-id)
"Return the image of a key, if any"
(let ((filename
(replace-regexp-in-string
"\n" ""
(shell-command-to-string
(format "%s --photo-viewer 'echo %%I >&2' --list-keys %s > /dev/null"
epg-gpg-program key-id)))))
(when (and (not (string-equal filename ""))
(file-exists-p filename))
(create-image filename))))
(defun mml2015-epg-key-image-to-string (key-id)
"Return a string with the image of a key, if any"
(let* ((result "")
(key-image (mml2015-epg-key-image key-id)))
(when key-image
(setq result " ")
(put-text-property 1 2 'display key-image result))
result))
(defun mml2015-epg-signature-to-string (signature)
(concat (epg-signature-to-string signature)
(mml2015-epg-key-image-to-string (epg-signature-key-id signature))))
(defun mml2015-epg-verify-result-to-string (verify-result)
(mapconcat #'mml2015-epg-signature-to-string verify-result "\n"))
(defun mml2015-epg-decrypt (handle ctl)
(catch 'error
(let ((inhibit-redisplay t)
......@@ -860,7 +890,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
(mm-set-handle-multipart-parameter
mm-security-handle 'gnus-info
(concat "OK\n"
(epg-verify-result-to-string
(mml2015-epg-verify-result-to-string
(epg-context-result-for context 'verify))))
(mm-set-handle-multipart-parameter
mm-security-handle 'gnus-info "OK"))
......@@ -908,7 +938,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
(if (epg-context-result-for context 'verify)
(mm-set-handle-multipart-parameter
mm-security-handle 'gnus-details
(epg-verify-result-to-string
(mml2015-epg-verify-result-to-string
(epg-context-result-for context 'verify)))))))
(defun mml2015-epg-verify (handle ctl)
......@@ -942,7 +972,8 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
(throw 'error handle)))
(mm-set-handle-multipart-parameter
mm-security-handle 'gnus-info
(epg-verify-result-to-string (epg-context-result-for context 'verify)))
(mml2015-epg-verify-result-to-string
(epg-context-result-for context 'verify)))
handle)))
(defun mml2015-epg-clear-verify ()
......@@ -965,7 +996,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
(progn
(mm-set-handle-multipart-parameter
mm-security-handle 'gnus-info
(epg-verify-result-to-string
(mml2015-epg-verify-result-to-string
(epg-context-result-for context 'verify)))
(delete-region (point-min) (point-max))
(insert (mm-decode-coding-string plain coding-system-for-read)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment