using the fringe to indicate good signatures
authorDavid Edmondson <dme@dme.org>
Thu, 20 Aug 2015 13:12:26 +0000 (14:12 +0100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:24 +0000 (14:49 -0700)
4c/b8cde2b6f237d46e3ec3afac65af346647bf5f [new file with mode: 0644]

diff --git a/4c/b8cde2b6f237d46e3ec3afac65af346647bf5f b/4c/b8cde2b6f237d46e3ec3afac65af346647bf5f
new file mode 100644 (file)
index 0000000..fab2e85
--- /dev/null
@@ -0,0 +1,182 @@
+Return-Path: <dme@dme.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 8DDF86DE0943\r
+ for <notmuch@notmuchmail.org>; Thu, 20 Aug 2015 06:12:49 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.814\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.814 tagged_above=-999 required=5 tests=[AWL=0.881, \r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
+ RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=0.001]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id RvM-p3lJ1M5g for <notmuch@notmuchmail.org>;\r
+ Thu, 20 Aug 2015 06:12:44 -0700 (PDT)\r
+Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com\r
+ [209.85.212.176])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id E05EB6DE01F5\r
+ for <notmuch@notmuchmail.org>; Thu, 20 Aug 2015 06:12:43 -0700 (PDT)\r
+Received: by wicne3 with SMTP id ne3so15822271wic.1\r
+ for <notmuch@notmuchmail.org>; Thu, 20 Aug 2015 06:12:39 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:user-agent:to:subject:from:date:message-id\r
+ :mime-version:content-type;\r
+ bh=cW5hWN9yFhifVxvOUCiFsgH5C9AWNafvwLlGjHPc+Hc=;\r
+ b=VNmu2jPi7/9I6jKJGMmBoXqtyKKjCKyn9bqnIT7hPMg3bTxY+wzgF1uH4NljtfRWCY\r
+ ttXVJIeXfBmvH61GSpfSZs7rSP2NVNqUARuAhwlqgPLLe4fkqheklEZmYrhCtdeh4lrI\r
+ U2uTOgZimIEki/CUMi+DMuuWx4VQMQwebHQk5AEXsG8PgpmBvt609w3h9/nywo4wIA+b\r
+ JOAn/n90c6Zvg5Q0AuDNXIrCWcSfAt5uMITN5gSZMa16ugUg/ZGCoiOu8I8OB0NyuCIy\r
+ sskFf/LYKUkVeHr1dFxxfEJxh/jjId7LeOlyi/wwyJwqjSqnDA2tht3xv7yjGhHILJvy\r
+ fu8g==\r
+X-Gm-Message-State:\r
+ ALoCoQm2yBl31OB+45rSFPTj2RCpQkIPIdeFeRPJy742IQ3HxabOFtil8TgLhJ2VaA/zrmcnSk4v\r
+X-Received: by 10.194.221.4 with SMTP id qa4mr5929577wjc.145.1440076359541;\r
+ Thu, 20 Aug 2015 06:12:39 -0700 (PDT)\r
+Received: from disaster-area.hh.sledj.net\r
+ ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])\r
+ by smtp.gmail.com with ESMTPSA id ma4sm5516453wjb.38.2015.08.20.06.12.37\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Thu, 20 Aug 2015 06:12:38 -0700 (PDT)\r
+Received: from localhost (30000@localhost [local]);\r
+ by localhost (OpenSMTPD) with ESMTPA id b311363a;\r
+ Thu, 20 Aug 2015 13:12:37 +0000 (UTC)\r
+User-Agent: OpenSMTPD enqueuer (Demoostik)\r
+To: notmuch@notmuchmail.org\r
+Subject: using the fringe to indicate good signatures\r
+From: David Edmondson <dme@dme.org>\r
+Date: Thu, 20 Aug 2015 14:12:26 +0100\r
+Message-ID: <m2mvxmxfwl.fsf@heart-of-gold.hh.sledj.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="==-=-=";\r
+ micalg=pgp-sha1; protocol="application/pgp-signature"\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 20 Aug 2015 13:12:49 -0000\r
+\r
+--==-=-=\r
+Content-Type: multipart/mixed; boundary="=-=-="\r
+\r
+--=-=-=\r
+Content-Type: text/plain\r
+\r
+After listening to bremner, dkg et al. from Heidelberg, I threw together\r
+a quick patch to see how we might indicate signature validity in the\r
+fringe. The intention is to prompt more discussion - this code is not\r
+ready to ship.\r
+\r
+The patch is attached. The result looks something like:\r
+    http://dme.org/data/images/notmuch-signed-fringe.png\r
+\r
+Thoughts?\r
+\r
+\r
+--=-=-=\r
+Content-Type: text/x-patch\r
+Content-Disposition: inline; filename=signed-fringe.diff\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 4dee34b..3d447af 100644\r
+=2D-- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -646,25 +646,46 @@ will return nil if the CID is unknown or cannot be re=\r
+trieved."\r
+       (indent-rigidly start (point) 1)))\r
+   t)\r
+=20\r
+=2D(defun notmuch-show-insert-part-multipart/signed (msg part content-type =\r
+nth depth button)\r
+=2D  (button-put button 'face 'notmuch-crypto-part-header)\r
+=2D  ;; add signature status button if sigstatus provided\r
+=2D  (if (plist-member part :sigstatus)\r
+=2D      (let* ((from (notmuch-show-get-header :From msg))\r
+=2D         (sigstatus (car (plist-get part :sigstatus))))\r
+=2D    (notmuch-crypto-insert-sigstatus-button sigstatus from))\r
+=2D    ;; if we're not adding sigstatus, tell the user how they can get it\r
+=2D    (button-put button 'help-echo "Set notmuch-crypto-process-mime to pr=\r
+ocess cryptographic MIME parts."))\r
++;; None of the existing fringe bitmaps are empty.\r
++(define-fringe-bitmap 'notmuch-show--fringe-empty '[])\r
+=20\r
+=2D  (let ((inner-parts (plist-get part :content))\r
+=2D    (start (point)))\r
+=2D    ;; Show all of the parts.\r
+=2D    (mapc (lambda (inner-part)\r
+=2D        (notmuch-show-insert-bodypart msg inner-part depth))\r
+=2D      inner-parts)\r
++(defun notmuch-show--sigstatus-to-fringe-string (status)\r
++  (let ((good-bad-ugly (plist-get status :status)))\r
++    (cond\r
++     ((string=3D good-bad-ugly "good")\r
++      (propertize "dummy" 'display\r
++                '(left-fringe notmuch-show--fringe-empty notmuch-crypto-signature-good=\r
+)))\r
++     ;; XXX dme: insert more here.\r
++     (t nil))))\r
+=20\r
+=2D    (when notmuch-show-indent-multipart\r
+=2D      (indent-rigidly start (point) 1)))\r
++(defun notmuch-show-insert-part-multipart/signed (msg part content-type nt=\r
+h depth button)\r
++  (let ((start-of-signed (point)))\r
++    (button-put button 'face 'notmuch-crypto-part-header)\r
++\r
++    (let ((sigstatus (car (plist-get part :sigstatus)))\r
++        (from (notmuch-show-get-header :From msg)))\r
++      ;; Add signature status button if status is provided.\r
++      (if sigstatus\r
++        (notmuch-crypto-insert-sigstatus-button sigstatus from)\r
++      ;; If we're not adding the status, tell the user how they can\r
++      ;; get it.\r
++      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process=\r
+ cryptographic MIME parts."))\r
++\r
++      (let ((inner-parts (plist-get part :content))\r
++          (start (point))\r
++          (fringe-string (notmuch-show--sigstatus-to-fringe-string sigstatus)))\r
++      ;; Show all of the parts.\r
++      (mapc (lambda (inner-part)\r
++              (notmuch-show-insert-bodypart msg inner-part depth))\r
++            inner-parts)\r
++\r
++      (when notmuch-show-indent-multipart\r
++        (indent-rigidly start (point) 1))\r
++\r
++      (when fringe-string\r
++        (replace-regexp "^" fringe-string nil start-of-signed (point))))\r
++      )\r
++    )\r
+   t)\r
+=20\r
+ (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type=\r
+ nth depth button)\r
+\r
+--=-=-=--\r
+\r
+--==-=-=\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+\r
+iKYEARECAGYFAlXV0jpfFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3Bl\r
+bnBncC5maWZ0aGhvcnNlbWFuLm5ldDc1M0Y5NDJDMEExNjc3MDE4OURGMUYyMDY5\r
+RUNEMEFCRjA0OTY1MTYACgkQaezQq/BJZRZIXACfSBOHJK7eXN/DAXDzvmZ6Tnb0\r
+UQ4An2zRMSiUKRanCDP6VzmQLk8mouAc\r
+=ooKn\r
+-----END PGP SIGNATURE-----\r
+--==-=-=--\r