Re:
[notmuch-archives.git] / 7f / 4e74db0986be0eb19eeaba0457062a9c14614a
1 Return-Path: <jrollins@servo.finestructure.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 7DBCF429E2F\r
6         for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:21 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.921\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5\r
12         tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id 18QhP2TASbD3 for <notmuch@notmuchmail.org>;\r
17         Sat, 28 May 2011 14:52:19 -0700 (PDT)\r
18 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
19         [131.215.239.19])\r
20         by olra.theworths.org (Postfix) with ESMTP id B21AE429E30\r
21         for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:14 -0700 (PDT)\r
22 Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
23         by earth-doxen-postvirus (Postfix) with ESMTP id 3B4A766E00B9;\r
24         Sat, 28 May 2011 14:52:13 -0700 (PDT)\r
25 X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
26 Received: from servo.finestructure.net (cpe-98-149-172-122.socal.res.rr.com\r
27         [98.149.172.122]) (Authenticated sender: jrollins)\r
28         by earth-doxen-submit (Postfix) with ESMTP id 41C0166E034C;\r
29         Sat, 28 May 2011 14:52:09 -0700 (PDT)\r
30 Received: by servo.finestructure.net (Postfix, from userid 1000)\r
31         id 2E9C07A3; Sat, 28 May 2011 14:52:05 -0700 (PDT)\r
32 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
33 To: Notmuch Mail <notmuch@notmuchmail.org>\r
34 Subject: [PATCH 09/25] emacs: Define several faces for the crypto-status\r
35  button\r
36 Date: Sat, 28 May 2011 14:51:44 -0700\r
37 Message-Id: <1306619520-25730-10-git-send-email-jrollins@finestructure.net>\r
38 X-Mailer: git-send-email 1.7.4.4\r
39 In-Reply-To: <1306619520-25730-9-git-send-email-jrollins@finestructure.net>\r
40 References: <1306619520-25730-1-git-send-email-jrollins@finestructure.net>\r
41         <1306619520-25730-2-git-send-email-jrollins@finestructure.net>\r
42         <1306619520-25730-3-git-send-email-jrollins@finestructure.net>\r
43         <1306619520-25730-4-git-send-email-jrollins@finestructure.net>\r
44         <1306619520-25730-5-git-send-email-jrollins@finestructure.net>\r
45         <1306619520-25730-6-git-send-email-jrollins@finestructure.net>\r
46         <1306619520-25730-7-git-send-email-jrollins@finestructure.net>\r
47         <1306619520-25730-8-git-send-email-jrollins@finestructure.net>\r
48         <1306619520-25730-9-git-send-email-jrollins@finestructure.net>\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53         <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Sat, 28 May 2011 21:52:22 -0000\r
62 \r
63 From: Thomas Jost <schnouki@schnouki.net>\r
64 \r
65 Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>\r
66 \r
67 jrollins modified this patch to conform to recent changes in the\r
68 crypto processing since this patch was originally sent in.\r
69 ---\r
70  emacs/notmuch-crypto.el |   42 ++++++++++++++++++++++++++++++++----------\r
71  1 files changed, 32 insertions(+), 10 deletions(-)\r
72 \r
73 diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el\r
74 index cb02840..f03266f 100644\r
75 --- a/emacs/notmuch-crypto.el\r
76 +++ b/emacs/notmuch-crypto.el\r
77 @@ -36,36 +36,58 @@ search."\r
78    :group 'notmuch\r
79    :type 'boolean)\r
80  \r
81 +(defface notmuch-crypto-signature-good\r
82 +  '((t (:background "green" :foreground "black")))\r
83 +  "Face used for good signatures."\r
84 +  :group 'notmuch)\r
85 +\r
86 +(defface notmuch-crypto-signature-good-key\r
87 +  '((t (:background "orange" :foreground "black")))\r
88 +  "Face used for good signatures."\r
89 +  :group 'notmuch)\r
90 +\r
91 +(defface notmuch-crypto-signature-bad\r
92 +  '((t (:background "red" :foreground "black")))\r
93 +  "Face used for bad signatures."\r
94 +  :group 'notmuch)\r
95 +\r
96 +(defface notmuch-crypto-signature-unknown\r
97 +  '((t (:background "red" :foreground "black")))\r
98 +  "Face used for signatures of unknown status."\r
99 +  :group 'notmuch)\r
100 +\r
101 +(defface notmuch-crypto-decryption\r
102 +  '((t (:background "purple" :foreground "black")))\r
103 +  "Face used for encryption/decryption status messages."\r
104 +  :group 'notmuch)\r
105 +\r
106  (define-button-type 'notmuch-crypto-status-button-type\r
107    'action '(lambda (button) (message (button-get button 'help-echo)))\r
108    'follow-link t\r
109 -  'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts."\r
110 -  'face '(:foreground "blue")\r
111 -  'mouse-face '(:foreground "blue"))\r
112 +  'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")\r
113  \r
114  (defun notmuch-crypto-insert-sigstatus-button (sigstatus from)\r
115    (let* ((status (plist-get sigstatus :status))\r
116          (help-msg nil)\r
117          (label "Signature not processed")\r
118 -        (face '(:background "red" :foreground "black")))\r
119 +        (face 'notmuch-crypto-signature-unknown))\r
120      (cond\r
121       ((string= status "good")\r
122        ; if userid present, userid has full or greater validity\r
123        (if (plist-member sigstatus :userid)\r
124           (let ((userid (plist-get sigstatus :userid)))\r
125             (setq label (concat "Good signature by: " userid))\r
126 -           (setq face '(:background "green" :foreground "black")))\r
127 +           (setq face 'notmuch-crypto-signature-good))\r
128         (let ((fingerprint (concat "0x" (plist-get sigstatus :fingerprint))))\r
129           (setq label (concat "Good signature by key: " fingerprint))\r
130 -         (setq face '(:background "orange" :foreground "black")))))\r
131 +         (setq face 'notmuch-crypto-signature-good-key))))\r
132       ((string= status "error")\r
133        (let ((keyid (concat "0x" (plist-get sigstatus :keyid))))\r
134 -       (setq label (concat "Unknown key ID " keyid " or unsupported algorithm"))\r
135 -       (setq face '(:background "red" :foreground "black"))))\r
136 +       (setq label (concat "Unknown key ID " keyid " or unsupported algorithm"))))\r
137       ((string= status "bad")\r
138        (let ((keyid (concat "0x" (plist-get sigstatus :keyid))))\r
139         (setq label (concat "Bad signature (claimed key ID " keyid ")"))\r
140 -       (setq face '(:background "red" :foreground "black"))))\r
141 +       (setq face 'notmuch-crypto-signature-bad)))\r
142       (t\r
143        (setq label "Unknown signature status")\r
144        (if status (setq label (concat label " \"" status "\"")))))\r
145 @@ -83,7 +105,7 @@ search."\r
146    (let* ((status (plist-get encstatus :status))\r
147          (help-msg nil)\r
148          (label "Decryption not attempted")\r
149 -        (face '(:background "purple" :foreground "black")))\r
150 +        (face 'notmuch-crypto-decryption))\r
151      (cond\r
152       ((string= status "good")\r
153        (setq label "Decryption successful"))\r
154 -- \r
155 1.7.4.4\r
156 \r