[PATCH v2 06/14] cli/reply: make references header creation easier to follow
[notmuch-archives.git] / bd / 57e4239ac70f435b32422d21c6b0c1245bb782
1 Return-Path: <jrollins@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 61917429E26\r
6         for <notmuch@notmuchmail.org>; Sat, 10 Dec 2011 13:19:25 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.29\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.29 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3, T_MIME_NO_TEXT=0.01] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id VJPAWwXGeeav for <notmuch@notmuchmail.org>;\r
16         Sat, 10 Dec 2011 13:19:25 -0800 (PST)\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
18         [131.215.239.19])\r
19         by olra.theworths.org (Postfix) with ESMTP id E8803431FB6\r
20         for <notmuch@notmuchmail.org>; Sat, 10 Dec 2011 13:19:24 -0800 (PST)\r
21 Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
22         by earth-doxen-postvirus (Postfix) with ESMTP id 904AE66E015B;\r
23         Sat, 10 Dec 2011 13:19:24 -0800 (PST)\r
24 X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
25 Received: from finestructure.net (cpe-76-174-137-84.socal.res.rr.com\r
26         [76.174.137.84]) (Authenticated sender: jrollins)\r
27         by earth-doxen-submit (Postfix) with ESMTP id CA33166E013A;\r
28         Sat, 10 Dec 2011 13:19:21 -0800 (PST)\r
29 Received: by finestructure.net (Postfix, from userid 1000)\r
30         id 7069450F; Sat, 10 Dec 2011 16:19:21 -0500 (EST)\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH 2/4] Introduce a generic tree-like abstraction for MIME\r
34         traversal.\r
35 In-Reply-To: <1323460468-4030-3-git-send-email-amdragon@mit.edu>\r
36 References: <1323027100-10307-1-git-send-email-amdragon@mit.edu>\r
37         <1323460468-4030-1-git-send-email-amdragon@mit.edu>\r
38         <1323460468-4030-3-git-send-email-amdragon@mit.edu>\r
39 User-Agent: Notmuch/0.10.2+74~g994a706 (http://notmuchmail.org) Emacs/23.3.1\r
40         (x86_64-pc-linux-gnu)\r
41 Date: Sat, 10 Dec 2011 13:19:21 -0800\r
42 Message-ID: <87liqk5dly.fsf@servo.finestructure.net>\r
43 MIME-Version: 1.0\r
44 Content-Type: multipart/signed; boundary="=-=-=";\r
45         micalg=pgp-sha256; protocol="application/pgp-signature"\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Sat, 10 Dec 2011 21:19:25 -0000\r
59 \r
60 --=-=-=\r
61 \r
62 On Fri,  9 Dec 2011 14:54:26 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
63 > +    /* Handle PGP/MIME parts */\r
64 > +    if (GMIME_IS_MULTIPART_ENCRYPTED (part) && out->ctx->decrypt) {\r
65 > +     if (out->children != 2) {\r
66 > +         /* this violates RFC 3156 section 4, so we won't bother with it. */\r
67 > +         fprintf (stderr, "Error: %d part(s) for a multipart/encrypted "\r
68 > +                  "message (should be exactly 2)\n",\r
69 > +                  out->children);\r
70 > +     } else {\r
71 > +         out->is_encrypted = TRUE;\r
72 \r
73 As per Dmitry's previous point, maybe it's better to do something like:\r
74 \r
75 if (GMIME_IS_MULTIPART_ENCRYPTED (part)) {\r
76     out->is_encrypted = TRUE;\r
77     if (out->ctx->decrypt) {\r
78         if (out->children != 2) {\r
79 ...\r
80 \r
81 And similarly for is_signed.\r
82 \r
83 > +         GMimeMultipartEncrypted *encrypteddata =\r
84 > +             GMIME_MULTIPART_ENCRYPTED (part);\r
85 > +         out->decrypted_child = g_mime_multipart_encrypted_decrypt\r
86 > +             (encrypteddata, out->ctx->cryptoctx, &err);\r
87 > +         if (out->decrypted_child) {\r
88 > +             out->decrypt_success = TRUE;\r
89 > +             out->is_signed = TRUE;\r
90 > +             out->sig_validity = g_mime_multipart_encrypted_get_signature_validity (encrypteddata);\r
91 \r
92 Encrypted messages are not necessarily signed, so we need to be careful\r
93 about setting is_signed = TRUE based just on decryption status.  The\r
94 problem is that gmime's handling of this stuff (at least last I looked\r
95 in 2.4) is not so good.\r
96 g_mime_multipart_encrypted_get_signature_validity () should return\r
97 GMIME_SIGNATURE_STATUS_UNKNOWN if there's no signature, so I think\r
98 is_signed should be set TRUE only if sig_validity is not UNKNOWN.\r
99 \r
100 I've really been meaning to overhaul this stuff for gmime 2.6.\r
101 Hopefully I'll start looking at that after these patches go through.\r
102 \r
103 jamie.\r
104 \r
105 --=-=-=\r
106 Content-Type: application/pgp-signature\r
107 \r
108 -----BEGIN PGP SIGNATURE-----\r
109 Version: GnuPG v1.4.11 (GNU/Linux)\r
110 \r
111 iQIcBAEBCAAGBQJO48zZAAoJEO00zqvie6q83/oP/Ag9WhT8EENXOZwkZKzciUyT\r
112 GK32zjjTpFsH6hUUpCdaLSsvM9GfIpAuepLIb18ldPc8JSH+NoHu9ZFn2r99GD5I\r
113 ERnXvYBFmMGvt6p5AIg93h4CoHZpGOyhEzYblc/0aj6mwf6LwP9wQ+WE1AY2jc4F\r
114 A+sFdrIG1CmHD2TMkAc2qs/B2q0xi/Y7J8rbGHvnjl82MQbxsX8UWZoTg0ZQdOC4\r
115 7PkuuiVaXVHPn3MO5764Wq6zR0eWm4I23sarISamc3DXJ2FtLwdg7rKCNyq5Gfya\r
116 cEC5KaVZYs8MGKEDj0848LMlQTWmbZ83YLMCiyqeP7kzRZdvak1e/igNxe1n2mRZ\r
117 U19psMcHWSTDih8nXIw4fST22SLenqnaxgYldUbMpwxYmDwAwEcNUgXzgYZgR7QE\r
118 msBtGSBFw4Li1cMWr+/KDfYMB+U+PfXFBNBQzU1JG35JufJaE/jMiz1FZHhruZz0\r
119 T8SXXEfcL058c8GI1Ux06IkFrNoCDrXxaLumyN2pM5Q1iRHBlkVrCwqDHbbdCLM6\r
120 CuaNsdf1lXTC0gX06iH0YuonYEWvUjwDheq2Lai2+BeuB4MP+AGfc+594cYzLmOm\r
121 OmUY07kqJztDruUs0AGrUCbWvIsPV+Gl6JLlq6ikGkCLgDxqnOLOPbxN4eIShKt/\r
122 4IRvUASm89TrtmmiCflt\r
123 =JrFN\r
124 -----END PGP SIGNATURE-----\r
125 --=-=-=--\r