[gnus git] branch master updated: m0-5-223-gb81c177 =1= Extract image from PGP key using the recommended --attribute-fd option.

Adam Sj??gren <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  b81c177679c7638b6fe49763a7f9c8865da2671c (commit)
      from  3deef576a8f10cefd58b88f6105a26d8e5af8b15 (commit)


- Log -----------------------------------------------------------------
commit b81c177679c7638b6fe49763a7f9c8865da2671c
Author: Adam Sjøgren <[email protected]>
Date:   Wed Dec 26 16:54:50 2012 +0100

    Extract image from PGP key using the recommended --attribute-fd option.
    
    * mml2015.el (mml2015-epg-key-image): use --attribute-fd rather than
    temporary file to get PGP key image. Pass no-show-photos when extracting
    image to avoid having it pop up twice.

diff --git a/lisp/mml2015.el b/lisp/mml2015.el
index 847d1fa..5d97603 100644
--- a/lisp/mml2015.el
+++ b/lisp/mml2015.el
@@ -822,15 +822,16 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
 
 (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))))
+  (with-temp-buffer
+    (set-buffer-multibyte nil)
+    (let* ((coding-system-for-write 'binary)
+           (coding-system-for-read 'binary)
+           (data (shell-command-to-string
+                  (format "%s --list-options no-show-photos --attribute-fd 2 --list-keys %s > /dev/null"
+                          epg-gpg-program key-id))))
+      (when (> (length data) 0)
+        (insert (substring data 16))
+        (create-image (buffer-string) nil t)))))
 
 (defun mml2015-epg-key-image-to-string (key-id)
   "Return a string with the image of a key, if any"

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/mml2015.el |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.