summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2012-12-26 13:20:21 +0900
committerDaiki Ueno <ueno@gnu.org>2012-12-26 13:20:21 +0900
commitf1c9aabc1808431ccd75916a0f277235f7c7f187 (patch)
treebac05d2b837a6ea2e099d1efff4f5edb53ddfe7b /lisp
parent12384b01a92b5f2ac9af84767e04993efd6a18cc (diff)
downloademacs-f1c9aabc1808431ccd75916a0f277235f7c7f187.tar.gz
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/epg.el25
-rw-r--r--lisp/gnus/ChangeLog16
-rw-r--r--lisp/gnus/mml2015.el41
4 files changed, 53 insertions, 35 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 73379a93027..2181a6dde7e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,9 +1,3 @@
-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
diff --git a/lisp/epg.el b/lisp/epg.el
index b79c5df4165..280c24616f2 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -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)
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 9bba17e5af5..cf92e6cc9f4 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,19 @@
+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
diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el
index 78293f61791..847d1fa786f 100644
--- a/lisp/gnus/mml2015.el
+++ b/lisp/gnus/mml2015.el
@@ -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)))