Re: [PATCH v2] Omit User-Agent: header by default
[notmuch-archives.git] / 88 / f17d3f37328cdd6fe58a2363021e19fe2e9dc3
1 Return-Path: <schnouki@schnouki.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 A0BE1431FAF\r
6         for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 15:32:30 -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: -0.1\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1]\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 wl3xOvKM99Do for <notmuch@notmuchmail.org>;\r
17         Thu, 19 Jan 2012 15:32:29 -0800 (PST)\r
18 Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])\r
19         by olra.theworths.org (Postfix) with ESMTP id 1FCCA431FAE\r
20         for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 15:32:29 -0800 (PST)\r
21 Received: from odin.local (nancy.schnouki.net [78.238.0.45])\r
22         by ks3536.kimsufi.com (Postfix) with ESMTPSA id AA6386C000A;\r
23         Fri, 20 Jan 2012 00:32:20 +0100 (CET)\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
25         s=key-schnouki; t=1327015941;\r
26         bh=XBc5pP1kDwcIb9f3Tmm58G9gl/BJiTbfKb72lirA0gU=;\r
27         h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:\r
28         MIME-Version:Content-Type;\r
29         b=hcn5cOZoaF8RQsHurZ0Z1BaB8SvYUyYII4hJxKtVc+tvDbAkkW/bjFWZcHZ+tqlRt\r
30         9wye7LWee1dE76qGS6zfXCVDvvRLK8t7Brrc4HmywToL/0aHfoGLD1gBcWBjQBW+yH\r
31         UQOkeaVF+A3LlvLH293qAp8UpvMC9drljg4TQqW4=\r
32 From: Thomas Jost <schnouki@schnouki.net>\r
33 To: Austin Clements <amdragon@MIT.EDU>\r
34 Subject: Re: [PATCH v2 2/2] Add pseudo-compatibility with gmime 2.6\r
35 In-Reply-To: <20120117222546.GT16740@mit.edu>\r
36 References: <8739bea9lc.fsf@thor.loria.fr>\r
37         <1326797453-9405-1-git-send-email-schnouki@schnouki.net>\r
38         <1326797453-9405-2-git-send-email-schnouki@schnouki.net>\r
39         <20120117222546.GT16740@mit.edu>\r
40 User-Agent: Notmuch/0.11+95~g205cf08 (http://notmuchmail.org) Emacs/24.0.92.1\r
41         (x86_64-unknown-linux-gnu)\r
42 Date: Fri, 20 Jan 2012 00:32:26 +0100\r
43 Message-ID: <87ty3r2rqt.fsf@schnouki.net>\r
44 MIME-Version: 1.0\r
45 Content-Type: multipart/signed; boundary="=-=-=";\r
46         micalg=pgp-sha1; protocol="application/pgp-signature"\r
47 Cc: notmuch@notmuchmail.org\r
48 X-BeenThere: notmuch@notmuchmail.org\r
49 X-Mailman-Version: 2.1.13\r
50 Precedence: list\r
51 List-Id: "Use and development of the notmuch mail system."\r
52         <notmuch.notmuchmail.org>\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
56 List-Post: <mailto:notmuch@notmuchmail.org>\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
60 X-List-Received-Date: Thu, 19 Jan 2012 23:32:30 -0000\r
61 \r
62 --=-=-=\r
63 Content-Type: text/plain\r
64 Content-Transfer-Encoding: quoted-printable\r
65 \r
66 Thanks for this review Austin. New version coming soon.\r
67 \r
68 On Tue, 17 Jan 2012 17:25:46 -0500, Austin Clements <amdragon@MIT.EDU> wrot=\r
69 e:\r
70 > Quoth Thomas Jost on Jan 17 at 11:50 am:\r
71 > > There are lots of API changes in gmime 2.6 crypto handling. By adding\r
72 > > preprocessor directives, it is however possible to add gmime 2.6 compat=\r
73 ibility\r
74 > > while preserving compatibility with gmime 2.4 too.\r
75 > >=20\r
76 > > This is mostly based on id:"8762i8hrb9.fsf@bookbinder.fernseed.info".\r
77 > >=20\r
78 > > This was tested against both gmime 2.6.4 and 2.4.31. With gmime 2.4.31,=\r
79  the\r
80 > > crypto tests all work fine (as expected). With gmime 2.6.4, one crypto =\r
81 test\r
82 > > fails (signature verification with signer key unavailable) but this wil=\r
83 l be hard\r
84 > > to fix since the new API does not report the reason why a signature ver=\r
85 ification\r
86 > > fails (other than the human-readable error message).\r
87 > > ---\r
88 > >  mime-node.c      |   56 ++++++++++++++++++++++++++++++--\r
89 > >  notmuch-client.h |   28 +++++++++++++++-\r
90 > >  notmuch-reply.c  |    7 ++++\r
91 > >  notmuch-show.c   |   95 ++++++++++++++++++++++++++++++++++++++++++++++=\r
92 ++++++++\r
93 > >  show-message.c   |    4 ++\r
94 > >  5 files changed, 185 insertions(+), 5 deletions(-)\r
95 > >=20\r
96 > > diff --git a/mime-node.c b/mime-node.c\r
97 > > index d26bb44..e575e1c 100644\r
98 > > --- a/mime-node.c\r
99 > > +++ b/mime-node.c\r
100 > > @@ -33,7 +33,11 @@ typedef struct mime_node_context {\r
101 > >      GMimeMessage *mime_message;\r
102 > >=20=20\r
103 > >      /* Context provided by the caller. */\r
104 > > +#ifdef GMIME_26\r
105 > > +    GMimeCryptoContext *cryptoctx;\r
106 > > +#else\r
107 > >      GMimeCipherContext *cryptoctx;\r
108 > > +#endif\r
109 > >      notmuch_bool_t decrypt;\r
110 > >  } mime_node_context_t;\r
111 > >=20=20\r
112 > > @@ -57,8 +61,12 @@ _mime_node_context_free (mime_node_context_t *res)\r
113 > >=20=20\r
114 > >  notmuch_status_t\r
115 > >  mime_node_open (const void *ctx, notmuch_message_t *message,\r
116 > > -           GMimeCipherContext *cryptoctx, notmuch_bool_t decrypt,\r
117 > > -           mime_node_t **root_out)\r
118 > > +#ifdef GMIME_26\r
119 > > +           GMimeCryptoContext *cryptoctx,\r
120 > > +#else\r
121 > > +           GMimeCipherContext *cryptoctx,\r
122 > > +#endif\r
123 > > +           notmuch_bool_t decrypt, mime_node_t **root_out)\r
124 > >  {\r
125 > >      const char *filename =3D notmuch_message_get_filename (message);\r
126 > >      mime_node_context_t *mctx;\r
127 > > @@ -112,12 +120,21 @@ DONE:\r
128 > >      return status;\r
129 > >  }\r
130 > >=20=20\r
131 > > +#ifdef GMIME_26\r
132 > > +static int\r
133 > > +_signature_list_free (GMimeSignatureList **proxy)\r
134 > > +{\r
135 > > +    g_object_unref (*proxy);\r
136 > > +    return 0;\r
137 > > +}\r
138 > > +#else\r
139 > >  static int\r
140 > >  _signature_validity_free (GMimeSignatureValidity **proxy)\r
141 > >  {\r
142 > >      g_mime_signature_validity_free (*proxy);\r
143 > >      return 0;\r
144 > >  }\r
145 > > +#endif\r
146 > >=20=20\r
147 > >  static mime_node_t *\r
148 > >  _mime_node_create (const mime_node_t *parent, GMimeObject *part)\r
149 > > @@ -165,11 +182,22 @@ _mime_node_create (const mime_node_t *parent, GMi=\r
150 meObject *part)\r
151 > >         GMimeMultipartEncrypted *encrypteddata =3D\r
152 > >             GMIME_MULTIPART_ENCRYPTED (part);\r
153 > >         node->decrypt_attempted =3D TRUE;\r
154 > > +#ifdef GMIME_26\r
155 > > +       GMimeDecryptResult *decrypt_result =3D NULL;\r
156 >=20\r
157 > Reading through the GMime code, it looks like we do have to unref\r
158 > decrypt_result.  I think this is easy, though.  Right after you call\r
159 > g_mime_decrypt_result_get_signatures below, do:\r
160 >=20\r
161 >   g_object_ref (node->sig_list);\r
162 >   g_object_unref (decrypt_result);\r
163 \r
164 Added, thanks!\r
165 \r
166 >=20\r
167 > > +       node->decrypted_child =3D g_mime_multipart_encrypted_decrypt\r
168 > > +           (encrypteddata, node->ctx->cryptoctx, &decrypt_result, &err);\r
169 > > +#else\r
170 > >         node->decrypted_child =3D g_mime_multipart_encrypted_decrypt\r
171 > >             (encrypteddata, node->ctx->cryptoctx, &err);\r
172 > > +#endif\r
173 > >         if (node->decrypted_child) {\r
174 > > -           node->decrypt_success =3D node->verify_attempted =3D TRUE;\r
175 > > +           node->decrypt_success =3D node->verify_attempted =3DTRUE;\r
176 >=20\r
177 > Whitespace.  (There should be no diff on the above line)\r
178 \r
179 Oops, my bad.\r
180 \r
181 >=20\r
182 > > +#ifdef GMIME_26\r
183 > > +           /* This may be NULL if the part is not signed. */\r
184 > > +           node->sig_list =3D g_mime_decrypt_result_get_signatures (decrypt_res=\r
185 ult);\r
186 > > +#else\r
187 > >             node->sig_validity =3D g_mime_multipart_encrypted_get_signature_vali=\r
188 dity (encrypteddata);\r
189 > > +#endif\r
190 > >         } else {\r
191 > >             fprintf (stderr, "Failed to decrypt part: %s\n",\r
192 > >                      (err ? err->message : "no error explanation given"));\r
193 > > @@ -182,6 +210,16 @@ _mime_node_create (const mime_node_t *parent, GMim=\r
194 eObject *part)\r
195 > >                  "(must be exactly 2)\n",\r
196 > >                  node->nchildren);\r
197 > >     } else {\r
198 > > +#ifdef GMIME_26\r
199 > > +       GMimeSignatureList *sig_list =3D g_mime_multipart_signed_verify\r
200 > > +           (GMIME_MULTIPART_SIGNED (part), node->ctx->cryptoctx, &err);\r
201 > > +       node->verify_attempted =3D TRUE;\r
202 > > +       node->sig_list =3D sig_list;\r
203 >=20\r
204 > Just a nit.  This could be\r
205 >   node->sig_list =3D g_mime_multipart_signed_verify ( ... )\r
206 > To me, the local variable just makes this code more verbose without\r
207 > adding anything.  Up to you.\r
208 \r
209 Yep, the local variable is useless. Removed it.\r
210 \r
211 >=20\r
212 > > +\r
213 > > +       if (!sig_list)\r
214 > > +           fprintf (stderr, "Failed to verify signed part: %s\n",\r
215 > > +                    (err ? err->message : "no error explanation given"));\r
216 > > +#else\r
217 > >         /* For some reason the GMimeSignatureValidity returned\r
218 > >          * here is not a const (inconsistent with that\r
219 > >          * returned by\r
220 > > @@ -200,12 +238,24 @@ _mime_node_create (const mime_node_t *parent, GMi=\r
221 meObject *part)\r
222 > >             *proxy =3D sig_validity;\r
223 > >             talloc_set_destructor (proxy, _signature_validity_free);\r
224 > >         }\r
225 > > +#endif\r
226 > >     }\r
227 > >      }\r
228 > >=20=20\r
229 > > +#ifdef GMIME_26\r
230 > > +    /* sig_list may be created in both above cases, so we need to\r
231 > > +     * cleanly handle it here. */\r
232 > > +    if (node->sig_list) {\r
233 > > +   GMimeSignatureList **proxy =3D\r
234 > > +       talloc (node, GMimeSignatureList *);\r
235 >=20\r
236 > This doesn't need to be split into two lines.\r
237 \r
238 You're right. It was more readable when that piece of code was more\r
239 indented, but now one line is fine :)\r
240 \r
241 >=20\r
242 > > +   *proxy =3D node->sig_list;\r
243 > > +   talloc_set_destructor (proxy, _signature_list_free);\r
244 > > +    }\r
245 > > +#else\r
246 > >      if (node->verify_attempted && !node->sig_validity)\r
247 > >     fprintf (stderr, "Failed to verify signed part: %s\n",\r
248 > >              (err ? err->message : "no error explanation given"));\r
249 > > +#endif\r
250 >=20\r
251 > I'd rather see the above as a separate #ifdef GMIME_26 and #ifndef\r
252 > GMIME_26, since they aren't logical alternates of each other.\r
253 \r
254 Agreed.\r
255 \r
256 >=20\r
257 > >=20=20\r
258 > >      if (err)\r
259 > >     g_error_free (err);\r
260 > > diff --git a/notmuch-client.h b/notmuch-client.h\r
261 > > index 62ede28..9167042 100644\r
262 > > --- a/notmuch-client.h\r
263 > > +++ b/notmuch-client.h\r
264 > > @@ -30,6 +30,12 @@\r
265 > >=20=20\r
266 > >  #include <gmime/gmime.h>\r
267 > >=20=20\r
268 > > +/* GMIME_CHECK_VERSION is only available in gmime >=3D 2.5. But so are\r
269 > > + * GMIME_MAJOR_VERSION and friends. */\r
270 > > +#ifdef GMIME_MAJOR_VERSION\r
271 > > +#define GMIME_26\r
272 > > +#endif\r
273 > > +\r
274 > >  #include "notmuch.h"\r
275 > >=20=20\r
276 > >  /* This is separate from notmuch-private.h because we're trying to\r
277 > > @@ -69,7 +75,11 @@ typedef struct notmuch_show_format {\r
278 > >      void (*part_start) (GMimeObject *part,\r
279 > >                     int *part_count);\r
280 > >      void (*part_encstatus) (int status);\r
281 > > +#ifdef GMIME_26\r
282 > > +    void (*part_sigstatus) (GMimeSignatureList* siglist);\r
283 > > +#else\r
284 > >      void (*part_sigstatus) (const GMimeSignatureValidity* validity);\r
285 > > +#endif\r
286 > >      void (*part_content) (GMimeObject *part);\r
287 > >      void (*part_end) (GMimeObject *part);\r
288 > >      const char *part_sep;\r
289 > > @@ -83,7 +93,11 @@ typedef struct notmuch_show_params {\r
290 > >      int entire_thread;\r
291 > >      int raw;\r
292 > >      int part;\r
293 > > +#ifdef GMIME_26\r
294 > > +    GMimeCryptoContext* cryptoctx;\r
295 > > +#else\r
296 > >      GMimeCipherContext* cryptoctx;\r
297 > > +#endif\r
298 > >      int decrypt;\r
299 > >  } notmuch_show_params_t;\r
300 > >=20=20\r
301 > > @@ -290,11 +304,17 @@ typedef struct mime_node {\r
302 > >=20=20\r
303 > >      /* True if signature verification on this part was attempted. */\r
304 > >      notmuch_bool_t verify_attempted;\r
305 > > +#ifdef GMIME_26\r
306 > > +    /* The list of signatures for signed or encrypted containers. If\r
307 > > +      * there are no signatures, this will be NULL. */\r
308 >=20\r
309 > Spacing.\r
310 >=20\r
311 > > +    GMimeSignatureList* sig_list;\r
312 > > +#else\r
313 > >      /* For signed or encrypted containers, the validity of the\r
314 > >       * signature.  May be NULL if signature verification failed.  If\r
315 > >       * there are simply no signatures, this will be non-NULL with an\r
316 > >       * empty signers list. */\r
317 > >      const GMimeSignatureValidity *sig_validity;\r
318 > > +#endif\r
319 > >=20=20\r
320 > >      /* Internal: Context inherited from the root iterator. */\r
321 > >      struct mime_node_context *ctx;\r
322 > > @@ -319,8 +339,12 @@ typedef struct mime_node {\r
323 > >   */\r
324 > >  notmuch_status_t\r
325 > >  mime_node_open (const void *ctx, notmuch_message_t *message,\r
326 > > -           GMimeCipherContext *cryptoctx, notmuch_bool_t decrypt,\r
327 > > -           mime_node_t **node_out);\r
328 > > +#ifdef GMIME_26\r
329 > > +           GMimeCryptoContext *cryptoctx,\r
330 > > +#else\r
331 > > +           GMimeCipherContext *cryptoctx,\r
332 > > +#endif\r
333 > > +           notmuch_bool_t decrypt, mime_node_t **node_out);\r
334 > >=20=20\r
335 > >  /* Return a new MIME node for the requested child part of parent.\r
336 > >   * parent will be used as the talloc context for the returned child\r
337 > > diff --git a/notmuch-reply.c b/notmuch-reply.c\r
338 > > index 0f682db..b3d7127 100644\r
339 > > --- a/notmuch-reply.c\r
340 > > +++ b/notmuch-reply.c\r
341 > > @@ -688,15 +688,22 @@ notmuch_reply_command (void *ctx, int argc, char =\r
342 *argv[])\r
343 > >     reply_format_func =3D notmuch_reply_format_default;\r
344 > >=20=20\r
345 > >      if (decrypt) {\r
346 > > +#ifdef GMIME_26\r
347 > > +   /* TODO: GMimePasswordRequestFunc */\r
348 > > +   params.cryptoctx =3D g_mime_gpg_context_new (NULL, "gpg");\r
349 > > +#else\r
350 > >     GMimeSession* session =3D g_object_new (g_mime_session_get_type(), NU=\r
351 LL);\r
352 > >     params.cryptoctx =3D g_mime_gpg_context_new (session, "gpg");\r
353 > > +#endif\r
354 > >     if (params.cryptoctx) {\r
355 > >         g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) params.cr=\r
356 yptoctx, FALSE);\r
357 > >         params.decrypt =3D TRUE;\r
358 > >     } else {\r
359 > >         fprintf (stderr, "Failed to construct gpg context.\n");\r
360 > >     }\r
361 > > +#ifndef GMIME_26\r
362 > >     g_object_unref (session);\r
363 > > +#endif\r
364 > >      }\r
365 > >=20=20\r
366 > >      config =3D notmuch_config_open (ctx, NULL, NULL);\r
367 > > diff --git a/notmuch-show.c b/notmuch-show.c\r
368 > > index 91f566c..10223e0 100644\r
369 > > --- a/notmuch-show.c\r
370 > > +++ b/notmuch-show.c\r
371 > > @@ -76,7 +76,11 @@ static void\r
372 > >  format_part_encstatus_json (int status);\r
373 > >=20=20\r
374 > >  static void\r
375 > > +#ifdef GMIME_26\r
376 > > +format_part_sigstatus_json (GMimeSignatureList* siglist);\r
377 > > +#else\r
378 > >  format_part_sigstatus_json (const GMimeSignatureValidity* validity);\r
379 > > +#endif\r
380 > >=20=20\r
381 > >  static void\r
382 > >  format_part_content_json (GMimeObject *part);\r
383 > > @@ -486,6 +490,21 @@ show_text_part_content (GMimeObject *part, GMimeSt=\r
384 ream *stream_out)\r
385 > >     g_object_unref(stream_filter);\r
386 > >  }\r
387 > >=20=20\r
388 > > +#ifdef GMIME_26\r
389 > > +static const char*\r
390 > > +signature_status_to_string (GMimeSignatureStatus x)\r
391 > > +{\r
392 > > +    switch (x) {\r
393 > > +    case GMIME_SIGNATURE_STATUS_GOOD:\r
394 > > +   return "good";\r
395 > > +    case GMIME_SIGNATURE_STATUS_BAD:\r
396 > > +   return "bad";\r
397 > > +    case GMIME_SIGNATURE_STATUS_ERROR:\r
398 > > +   return "error";\r
399 > > +    }\r
400 > > +    return "unknown";\r
401 > > +}\r
402 > > +#else\r
403 > >  static const char*\r
404 > >  signer_status_to_string (GMimeSignerStatus x)\r
405 > >  {\r
406 > > @@ -501,6 +520,7 @@ signer_status_to_string (GMimeSignerStatus x)\r
407 > >      }\r
408 > >      return "unknown";\r
409 > >  }\r
410 > > +#endif\r
411 > >=20=20\r
412 > >  static void\r
413 > >  format_part_start_text (GMimeObject *part, int *part_count)\r
414 > > @@ -592,6 +612,73 @@ format_part_encstatus_json (int status)\r
415 > >      printf ("}]");\r
416 > >  }\r
417 > >=20=20\r
418 > > +#ifdef GMIME_26\r
419 > > +static void\r
420 > > +format_part_sigstatus_json (GMimeSignatureList *siglist)\r
421 > > +{\r
422 > > +    printf (", \"sigstatus\": [");\r
423 > > +\r
424 > > +    if (!siglist) {\r
425 > > +   printf ("]");\r
426 > > +   return;\r
427 > > +     }\r
428 >=20\r
429 > Indentation.\r
430 >=20\r
431 > > +\r
432 > > +    void *ctx_quote =3D talloc_new (NULL);\r
433 > > +    int i;\r
434 > > +    for (i =3D 0; i < g_mime_signature_list_length (siglist); i++) {\r
435 > > +   GMimeSignature *signature =3D g_mime_signature_list_get_signature (si=\r
436 glist, i);\r
437 > > +\r
438 > > +   if (i > 0)\r
439 > > +       printf (", ");\r
440 > > +\r
441 > > +   printf ("{");\r
442 > > +\r
443 > > +   /* status */\r
444 > > +   GMimeSignatureStatus status =3D g_mime_signature_get_status (signatur=\r
445 e);\r
446 > > +   printf ("\"status\": %s",\r
447 > > +           json_quote_str (ctx_quote,\r
448 > > +                           signature_status_to_string (status)));\r
449 > > +\r
450 > > +   GMimeCertificate *certificate =3D g_mime_signature_get_certificate (s=\r
451 ignature);\r
452 > > +   if (status =3D=3D GMIME_SIGNATURE_STATUS_GOOD) {\r
453 > > +       if (certificate)\r
454 > > +           printf (", \"fingerprint\": %s", json_quote_str (ctx_quote, g_mime_c=\r
455 ertificate_get_fingerprint (certificate)));\r
456 > > +       /* these dates are seconds since the epoch; should we\r
457 > > +        * provide a more human-readable format string? */\r
458 > > +       time_t created =3D g_mime_signature_get_created (signature);\r
459 > > +       if (created !=3D -1)\r
460 > > +           printf (", \"created\": %d", (int) created);\r
461 > > +       time_t expires =3D g_mime_signature_get_expires (signature);\r
462 > > +       if (expires > 0)\r
463 > > +           printf (", \"expires\": %d", (int) expires);\r
464 > > +       /* output user id only if validity is FULL or ULTIMATE. */\r
465 > > +       /* note that gmime is using the term "trust" here, which\r
466 > > +        * is WRONG.  It's actually user id "validity". */\r
467 > > +       if (certificate) {\r
468 > > +           const char *name =3D g_mime_certificate_get_name (certificate);\r
469 > > +           GMimeCertificateTrust trust =3D g_mime_certificate_get_trust (certif=\r
470 icate);\r
471 > > +           if (name && (trust =3D=3D GMIME_CERTIFICATE_TRUST_FULLY || trust =3D=\r
472 =3D GMIME_CERTIFICATE_TRUST_ULTIMATE))\r
473 > > +               printf (", \"userid\": %s", json_quote_str (ctx_quote, name));\r
474 > > +       }\r
475 > > +   } else if (certificate) {\r
476 > > +       const char *key_id =3D g_mime_certificate_get_key_id (certificate=\r
477 );\r
478 > > +       if (key_id)\r
479 > > +           printf (", \"keyid\": %s", json_quote_str (ctx_quote, key_id));\r
480 > > +   }\r
481 > > +\r
482 > > +   GMimeSignatureError errors =3D g_mime_signature_get_errors (signature=\r
483 );\r
484 > > +   if (errors !=3D GMIME_SIGNATURE_ERROR_NONE) {\r
485 > > +       printf (", \"errors\": %d", errors);\r
486 > > +   }\r
487 > > +\r
488 > > +   printf ("}");\r
489 > > +     }\r
490 > > +\r
491 > > +    printf ("]");\r
492 > > +\r
493 > > +    talloc_free (ctx_quote);\r
494 > > +}\r
495 > > +#else\r
496 > >  static void\r
497 > >  format_part_sigstatus_json (const GMimeSignatureValidity* validity)\r
498 > >  {\r
499 > > @@ -652,6 +739,7 @@ format_part_sigstatus_json (const GMimeSignatureVal=\r
500 idity* validity)\r
501 > >=20=20\r
502 > >      talloc_free (ctx_quote);\r
503 > >  }\r
504 > > +#endif\r
505 > >=20=20\r
506 > >  static void\r
507 > >  format_part_content_json (GMimeObject *part)\r
508 > > @@ -990,13 +1078,20 @@ notmuch_show_command (void *ctx, unused (int arg=\r
509 c), unused (char *argv[]))\r
510 > >     } else if ((STRNCMP_LITERAL (argv[i], "--verify") =3D=3D 0) ||\r
511 > >                (STRNCMP_LITERAL (argv[i], "--decrypt") =3D=3D 0)) {\r
512 > >         if (params.cryptoctx =3D=3D NULL) {\r
513 > > +#ifdef GMIME_26\r
514 > > +           /* TODO: GMimePasswordRequestFunc */\r
515 > > +           if (NULL =3D=3D (params.cryptoctx =3D g_mime_gpg_context_new(NULL, "=\r
516 gpg")))\r
517 > > +#else\r
518 > >             GMimeSession* session =3D g_object_new(g_mime_session_get_type(), NU=\r
519 LL);\r
520 > >             if (NULL =3D=3D (params.cryptoctx =3D g_mime_gpg_context_new(session=\r
521 , "gpg")))\r
522 > > +#endif\r
523 > >                 fprintf (stderr, "Failed to construct gpg context.\n");\r
524 > >             else\r
525 > >                 g_mime_gpg_context_set_always_trust((GMimeGpgContext*)params.cry=\r
526 ptoctx, FALSE);\r
527 > > +#ifndef GMIME_26\r
528 > >             g_object_unref (session);\r
529 > >             session =3D NULL;\r
530 > > +#endif\r
531 > >         }\r
532 > >         if (STRNCMP_LITERAL (argv[i], "--decrypt") =3D=3D 0)\r
533 > >             params.decrypt =3D 1;\r
534 > > diff --git a/show-message.c b/show-message.c\r
535 > > index 8768889..65269fd 100644\r
536 > > --- a/show-message.c\r
537 > > +++ b/show-message.c\r
538 > > @@ -48,7 +48,11 @@ show_message_part (mime_node_t *node,\r
539 > >     format->part_encstatus (node->decrypt_success);\r
540 > >=20=20\r
541 > >      if (node->verify_attempted && format->part_sigstatus)\r
542 > > +#ifdef GMIME_26\r
543 > > +   format->part_sigstatus (node->sig_list);\r
544 > > +#else\r
545 > >     format->part_sigstatus (node->sig_validity);\r
546 > > +#endif\r
547 > >=20=20\r
548 > >      format->part_content (part);\r
549 > >=20=20\r
550 \r
551 =2D-=20\r
552 Thomas/Schnouki\r
553 \r
554 --=-=-=\r
555 Content-Type: application/pgp-signature\r
556 \r
557 -----BEGIN PGP SIGNATURE-----\r
558 Version: GnuPG v1.4.11 (GNU/Linux)\r
559 \r
560 iQEcBAEBAgAGBQJPGKgLAAoJEMPdciX+bh5ISqYH/jjydMmQUsAQMzTWftKjG4IP\r
561 dZYXY3np0IBlyxwgqshgJl9diekl3hjQOAiib54YC8Ypvp2kplN3inkJNNqla0E0\r
562 FeKYvsHEec7HxHfm0nC4DMULOZht+HIQc7DSub5aTUCV0yX8C2ftLPnqZdcuShyV\r
563 RiYHmr0jWejCwHVHGJSSGa9AGJNrIKJY943omT+jeDbgP07Z7Yd14eYwSdkD/0s9\r
564 tFftpqFZF8kiM1Cz9bAit23oDmECS33zWDlBw1kn3cQgtKNZS7iPZn6tTEEwR5p4\r
565 OrRdVYdEGjH0OE52BzD7EkFJ5vPrW6y/UZ12jnM6Dx2HdFJW6BPt6yvZR+WCSzU=\r
566 =Eklo\r
567 -----END PGP SIGNATURE-----\r
568 --=-=-=--\r