emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111333: Move photo ID display code f


From: Daiki Ueno
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111333: Move photo ID display code from epg.el to gnus/mml2015.el.
Date: Wed, 26 Dec 2012 13:20:21 +0900
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111333
committer: Daiki Ueno <address@hidden>
branch nick: trunk
timestamp: Wed 2012-12-26 13:20:21 +0900
message:
  Move photo ID display code from epg.el to gnus/mml2015.el.
  
  2012-12-26  Daiki Ueno  <address@hidden>
  * 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  <address@hidden>
  * 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.
modified:
  lisp/ChangeLog
  lisp/epg.el
  lisp/gnus/ChangeLog
  lisp/gnus/mml2015.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-12-25 22:49:35 +0000
+++ b/lisp/ChangeLog    2012-12-26 04:20:21 +0000
@@ -1,9 +1,3 @@
-2012-12-25  Adam Sjøgren  <address@hidden>
-
-       * 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 <address@hidden>  (tiny change)
 
        * startup.el (initial-buffer-choice): Allow function as value

=== modified file 'lisp/epg.el'
--- a/lisp/epg.el       2012-12-25 22:49:35 +0000
+++ b/lisp/epg.el       2012-12-26 04:20:21 +0000
@@ -967,34 +967,12 @@
        (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 @@
           ((eq (epg-signature-status signature) 'no-pubkey)
            "No public key for "))
      key-id
-     key-image
      (if user-id
         (concat " "
                 (if (stringp user-id)

=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2012-12-25 23:38:16 +0000
+++ b/lisp/gnus/ChangeLog       2012-12-26 04:20:21 +0000
@@ -1,3 +1,19 @@
+2012-12-26  Daiki Ueno  <address@hidden>
+
+       * 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  <address@hidden>
+
+       * 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  <address@hidden>
 
        * plstore.el (plstore-passphrase-callback-function): Fix error when

=== modified file 'lisp/gnus/mml2015.el'
--- a/lisp/gnus/mml2015.el      2012-01-19 07:21:25 +0000
+++ b/lisp/gnus/mml2015.el      2012-12-26 04:20:21 +0000
@@ -735,6 +735,7 @@
 
 (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 @@
 (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 @@
 (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 @@
        (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 @@
            (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 (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 @@
         (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 @@
        (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)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]