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