Gnus development mailing list
 help / color / mirror / Atom feed
From: David Edmondson <dme@dme.org>
To: ding@gnus.org
Cc: David Edmondson <dme@dme.org>
Subject: [PATCH] mml2015.el: Limit the size of key images inserted into articles
Date: Thu, 13 Jun 2013 10:47:51 +0100	[thread overview]
Message-ID: <1371116871-27612-1-git-send-email-dme@dme.org> (raw)
In-Reply-To: <cun61y3mccl.fsf@hotblack-desiato.hh.sledj.net>

* Add `mml2015-maximum-key-image-dimension', which specifies a limit
  on the width or height of any key images that are inserted into the
  article buffer.
---
 lisp/mml2015.el |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/mml2015.el b/lisp/mml2015.el
index 5d122df..67cf31d 100644
--- a/lisp/mml2015.el
+++ b/lisp/mml2015.el
@@ -146,6 +146,11 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
   :group 'mime-security
   :type 'boolean)
 
+(defcustom mml2015-maximum-key-image-dimension 64
+  "The maximum dimension (width or height) of any key images."
+  :group 'mime-security
+  :type 'integer)
+
 ;; Extract plaintext from cleartext signature.  IMO, this kind of task
 ;; should be done by GnuPG rather than Elisp, but older PGP backends
 ;; (such as Mailcrypt, and PGG) discard the output from GnuPG.
@@ -873,13 +878,18 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
         (insert (substring data 16))
         (create-image (buffer-string) nil t)))))
 
+(autoload 'gnus-rescale-image "gnus-util")
+
 (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))
+      (put-text-property 1 2 'display (gnus-rescale-image key-image
+							  (cons mml2015-maximum-key-image-dimension
+								mml2015-maximum-key-image-dimension))
+			 result))
     result))
 
 (defun mml2015-epg-signature-to-string (signature)
-- 
1.7.10.4




  reply	other threads:[~2013-06-13  9:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28 14:02 controlling the size of PGP key images David Edmondson
2013-06-13  9:47 ` David Edmondson [this message]
2013-06-14  3:06   ` [PATCH] mml2015.el: Limit the size of key images inserted into articles Daiki Ueno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371116871-27612-1-git-send-email-dme@dme.org \
    --to=dme@dme.org \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).