summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/epg.el28
2 files changed, 32 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2181a6dde7e..73379a93027 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+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 833a68d6e7e..b79c5df4165 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -967,11 +967,34 @@ 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)))
+ (pubkey-algorithm (epg-signature-pubkey-algorithm signature))
+ (key-id (epg-signature-key-id signature))
+ (key-image (epg-key-image-to-string key-id)))
(concat
(cond ((eq (epg-signature-status signature) 'good)
"Good signature from ")
@@ -985,7 +1008,8 @@ This function is for internal use only."
"Signature made by revoked key ")
((eq (epg-signature-status signature) 'no-pubkey)
"No public key for "))
- (epg-signature-key-id signature)
+ key-id
+ key-image
(if user-id
(concat " "
(if (stringp user-id)