aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2012-12-26 05:31:26 +0100
committerJoakim Verona2012-12-26 05:31:26 +0100
commit119d7b57675dcfc0bd4232852fe58009e0a85153 (patch)
treeb259d8db7201073dd78ca5a78926e1f488227cc8
parent039071b2f39251ee0a72eb50df2917382e5b1a24 (diff)
parentf1c9aabc1808431ccd75916a0f277235f7c7f187 (diff)
downloademacs-119d7b57675dcfc0bd4232852fe58009e0a85153.tar.gz
emacs-119d7b57675dcfc0bd4232852fe58009e0a85153.zip
auto upstream
-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 @@
12012-12-25 Adam Sjøgren <asjo@koldfront.dk>
2
3 * epg.el (epg-signature-to-string): Use new functions
4 epg-key-image, epg-key-image-to-string to find and display image
5 from key.
6
72012-12-24 Constantin Kulikov <zxnotdead@gmail.com> (tiny change) 12012-12-24 Constantin Kulikov <zxnotdead@gmail.com> (tiny change)
8 2
9 * startup.el (initial-buffer-choice): Allow function as value 3 * 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."
967 (setcdr entry value) 967 (setcdr entry value)
968 (epg-context-set-result context (cons (cons name value) result))))) 968 (epg-context-set-result context (cons (cons name value) result)))))
969 969
970(defun epg-key-image (key-id)
971 "Return the image of a key, if any"
972 (let ((filename
973 (replace-regexp-in-string
974 "\n" ""
975 (shell-command-to-string
976 (concat "/usr/bin/gpg --photo-viewer 'echo %I >&2' --list-keys "
977 key-id " > /dev/null")))))
978 (when (and (not (string-equal filename ""))
979 (file-exists-p filename))
980 (create-image filename))))
981
982(defun epg-key-image-to-string (key-id)
983 "Return a string with the image of a key, if any"
984 (let* ((result "")
985 (key-image (epg-key-image key-id)))
986 (when key-image
987 (setq result " ")
988 (put-text-property 1 2 'display key-image result))
989 result))
990
991(defun epg-signature-to-string (signature) 970(defun epg-signature-to-string (signature)
992 "Convert SIGNATURE to a human readable string." 971 "Convert SIGNATURE to a human readable string."
993 (let* ((user-id (cdr (assoc (epg-signature-key-id signature) 972 (let* ((user-id (cdr (assoc (epg-signature-key-id signature)
994 epg-user-id-alist))) 973 epg-user-id-alist)))
995 (pubkey-algorithm (epg-signature-pubkey-algorithm signature)) 974 (pubkey-algorithm (epg-signature-pubkey-algorithm signature))
996 (key-id (epg-signature-key-id signature)) 975 (key-id (epg-signature-key-id signature)))
997 (key-image (epg-key-image-to-string key-id)))
998 (concat 976 (concat
999 (cond ((eq (epg-signature-status signature) 'good) 977 (cond ((eq (epg-signature-status signature) 'good)
1000 "Good signature from ") 978 "Good signature from ")
@@ -1009,7 +987,6 @@ This function is for internal use only."
1009 ((eq (epg-signature-status signature) 'no-pubkey) 987 ((eq (epg-signature-status signature) 'no-pubkey)
1010 "No public key for ")) 988 "No public key for "))
1011 key-id 989 key-id
1012 key-image
1013 (if user-id 990 (if user-id
1014 (concat " " 991 (concat " "
1015 (if (stringp user-id) 992 (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 @@
12012-12-26 Daiki Ueno <ueno@gnu.org>
2
3 * mml2015.el (mml2015-epg-signature-to-string): New function.
4 (mml2015-epg-verify-result-to-string): New function.
5 (mml2015-epg-decrypt, mml2015-epg-clear-decrypt, mml2015-epg-verify)
6 (mml2015-epg-clear-verify): Use mml2015-epg-verify-result-to-string
7 instead of epg-verify-result-to-string.
8 (epg-signature-key-id, epg-signature-to-string): Autoload.
9 (epg-verify-result-to-string): Remove autoload.
10
112012-12-25 Adam Sjøgren <asjo@koldfront.dk>
12
13 * mml2015.el (mml2015-epg-key-image): New function, to retrieve photo
14 ID image from GPG public key.
15 (mml2015-epg-key-image-to-string): New function.
16
12012-12-25 Leo Liu <sdl.web@gmail.com> 172012-12-25 Leo Liu <sdl.web@gmail.com>
2 18
3 * plstore.el (plstore-passphrase-callback-function): Fix error when 19 * 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'."
735 735
736(defvar epg-user-id-alist) 736(defvar epg-user-id-alist)
737(defvar epg-digest-algorithm-alist) 737(defvar epg-digest-algorithm-alist)
738(defvar epg-gpg-program)
738(defvar inhibit-redisplay) 739(defvar inhibit-redisplay)
739 740
740(autoload 'epg-make-context "epg") 741(autoload 'epg-make-context "epg")
@@ -743,7 +744,6 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
743(autoload 'epg-context-set-signers "epg") 744(autoload 'epg-context-set-signers "epg")
744(autoload 'epg-context-result-for "epg") 745(autoload 'epg-context-result-for "epg")
745(autoload 'epg-new-signature-digest-algorithm "epg") 746(autoload 'epg-new-signature-digest-algorithm "epg")
746(autoload 'epg-verify-result-to-string "epg")
747(autoload 'epg-list-keys "epg") 747(autoload 'epg-list-keys "epg")
748(autoload 'epg-decrypt-string "epg") 748(autoload 'epg-decrypt-string "epg")
749(autoload 'epg-verify-string "epg") 749(autoload 'epg-verify-string "epg")
@@ -755,6 +755,8 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
755(autoload 'epg-sub-key-capability "epg") 755(autoload 'epg-sub-key-capability "epg")
756(autoload 'epg-sub-key-validity "epg") 756(autoload 'epg-sub-key-validity "epg")
757(autoload 'epg-sub-key-fingerprint "epg") 757(autoload 'epg-sub-key-fingerprint "epg")
758(autoload 'epg-signature-key-id "epg")
759(autoload 'epg-signature-to-string "epg")
758(autoload 'epg-configuration "epg-config") 760(autoload 'epg-configuration "epg-config")
759(autoload 'epg-expand-group "epg-config") 761(autoload 'epg-expand-group "epg-config")
760(autoload 'epa-select-keys "epa") 762(autoload 'epa-select-keys "epa")
@@ -818,6 +820,34 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
818 (setq secret-keys (cdr secret-keys)))) 820 (setq secret-keys (cdr secret-keys))))
819 secret-key)) 821 secret-key))
820 822
823(defun mml2015-epg-key-image (key-id)
824 "Return the image of a key, if any"
825 (let ((filename
826 (replace-regexp-in-string
827 "\n" ""
828 (shell-command-to-string
829 (format "%s --photo-viewer 'echo %%I >&2' --list-keys %s > /dev/null"
830 epg-gpg-program key-id)))))
831 (when (and (not (string-equal filename ""))
832 (file-exists-p filename))
833 (create-image filename))))
834
835(defun mml2015-epg-key-image-to-string (key-id)
836 "Return a string with the image of a key, if any"
837 (let* ((result "")
838 (key-image (mml2015-epg-key-image key-id)))
839 (when key-image
840 (setq result " ")
841 (put-text-property 1 2 'display key-image result))
842 result))
843
844(defun mml2015-epg-signature-to-string (signature)
845 (concat (epg-signature-to-string signature)
846 (mml2015-epg-key-image-to-string (epg-signature-key-id signature))))
847
848(defun mml2015-epg-verify-result-to-string (verify-result)
849 (mapconcat #'mml2015-epg-signature-to-string verify-result "\n"))
850
821(defun mml2015-epg-decrypt (handle ctl) 851(defun mml2015-epg-decrypt (handle ctl)
822 (catch 'error 852 (catch 'error
823 (let ((inhibit-redisplay t) 853 (let ((inhibit-redisplay t)
@@ -860,7 +890,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
860 (mm-set-handle-multipart-parameter 890 (mm-set-handle-multipart-parameter
861 mm-security-handle 'gnus-info 891 mm-security-handle 'gnus-info
862 (concat "OK\n" 892 (concat "OK\n"
863 (epg-verify-result-to-string 893 (mml2015-epg-verify-result-to-string
864 (epg-context-result-for context 'verify)))) 894 (epg-context-result-for context 'verify))))
865 (mm-set-handle-multipart-parameter 895 (mm-set-handle-multipart-parameter
866 mm-security-handle 'gnus-info "OK")) 896 mm-security-handle 'gnus-info "OK"))
@@ -908,7 +938,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
908 (if (epg-context-result-for context 'verify) 938 (if (epg-context-result-for context 'verify)
909 (mm-set-handle-multipart-parameter 939 (mm-set-handle-multipart-parameter
910 mm-security-handle 'gnus-details 940 mm-security-handle 'gnus-details
911 (epg-verify-result-to-string 941 (mml2015-epg-verify-result-to-string
912 (epg-context-result-for context 'verify))))))) 942 (epg-context-result-for context 'verify)))))))
913 943
914(defun mml2015-epg-verify (handle ctl) 944(defun mml2015-epg-verify (handle ctl)
@@ -942,7 +972,8 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
942 (throw 'error handle))) 972 (throw 'error handle)))
943 (mm-set-handle-multipart-parameter 973 (mm-set-handle-multipart-parameter
944 mm-security-handle 'gnus-info 974 mm-security-handle 'gnus-info
945 (epg-verify-result-to-string (epg-context-result-for context 'verify))) 975 (mml2015-epg-verify-result-to-string
976 (epg-context-result-for context 'verify)))
946 handle))) 977 handle)))
947 978
948(defun mml2015-epg-clear-verify () 979(defun mml2015-epg-clear-verify ()
@@ -965,7 +996,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
965 (progn 996 (progn
966 (mm-set-handle-multipart-parameter 997 (mm-set-handle-multipart-parameter
967 mm-security-handle 'gnus-info 998 mm-security-handle 'gnus-info
968 (epg-verify-result-to-string 999 (mml2015-epg-verify-result-to-string
969 (epg-context-result-for context 'verify))) 1000 (epg-context-result-for context 'verify)))
970 (delete-region (point-min) (point-max)) 1001 (delete-region (point-min) (point-max))
971 (insert (mm-decode-coding-string plain coding-system-for-read))) 1002 (insert (mm-decode-coding-string plain coding-system-for-read)))