From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/83317 Path: news.gmane.org!not-for-mail From: David Edmondson Newsgroups: gmane.emacs.gnus.general Subject: [PATCH] mml2015.el: Limit the size of key images inserted into articles Date: Thu, 13 Jun 2013 10:47:51 +0100 Message-ID: <1371116871-27612-1-git-send-email-dme@dme.org> References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1371117004 15124 80.91.229.3 (13 Jun 2013 09:50:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Jun 2013 09:50:04 +0000 (UTC) Cc: David Edmondson To: ding@gnus.org Original-X-From: ding-owner+M31583@lists.math.uh.edu Thu Jun 13 11:50:04 2013 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Un4AN-0003Pk-05 for ding-account@gmane.org; Thu, 13 Jun 2013 11:50:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1Un48f-0004MU-3k; Thu, 13 Jun 2013 04:48:17 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Un48d-0004MD-38 for ding@lists.math.uh.edu; Thu, 13 Jun 2013 04:48:15 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1Un48a-0007Y0-Ss for ding@lists.math.uh.edu; Thu, 13 Jun 2013 04:48:14 -0500 Original-Received: from mail-wg0-f47.google.com ([74.125.82.47]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1Un48Y-00067N-SZ for ding@gnus.org; Thu, 13 Jun 2013 11:48:10 +0200 Original-Received: by mail-wg0-f47.google.com with SMTP id l18so4373109wgh.14 for ; Thu, 13 Jun 2013 02:48:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Z9I82aQtAY358WBYwIEXrTjuMN+8GU+23GE9az3VkdM=; b=GADtfVo2xVeAkVxt2P0Ndkbssnwq4hAuALFTynvYwo7BfWocMOyzHafF+69jGvKdqi 96i6YI/TkxFQJZ+1XFgEbs/tp0r08nXAseXzzopC+YhHfU8Qcmn3riAnh6X9pm9VdnMx P8DFEEle/nTzqBTP1EFsp4GMxq64Plie8RJLskGW61EmTc2T+nNCosj9wyLEQJWEB9de zdx3zTHKaMXVXo1LQUPMfkDeUJaEy/mTBCrL9N3wKEJcVLyfcTkW2OkIF69kVCBWFPB0 unGv4uHtODOaba9eMVKLYlk2A418im4skYXCASCODNfX1VZvCiwve7uLocyBsr/tAqD3 W6mw== X-Received: by 10.180.11.194 with SMTP id s2mr7026279wib.7.1371116885354; Thu, 13 Jun 2013 02:48:05 -0700 (PDT) Original-Received: from hotblack-desiato.hh.sledj.net (hotblack-desiato.hh.sledj.net. [2a01:348:1a2:1:a288:b4ff:fe8a:77d8]) by mx.google.com with ESMTPSA id h8sm30105697wiz.9.2013.06.13.02.48.03 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 02:48:04 -0700 (PDT) Original-Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 2CD4C1003FC; Thu, 13 Jun 2013 10:48:00 +0100 (BST) X-Mailer: git-send-email 1.7.10.4 In-Reply-To: X-Gm-Message-State: ALoCoQmBhv4JbexGUBuhMTFrwoOr3BXiz/4t5fHL0bFaBMzVZgRsUhSJi73wBMFEekA+BUeQA628 X-Spam-Score: -2.9 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:83317 Archived-At: * 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