[PATCH v2 1/3] cli: use notmuch_bool_t for boolean fields in notmuch_show_params_t
authorJani Nikula <jani@nikula.org>
Mon, 6 Feb 2012 19:57:21 +0000 (21:57 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:13 +0000 (09:44 -0800)
e6/0a06c703354815d29a5243c7f03714603d40d2 [new file with mode: 0644]

diff --git a/e6/0a06c703354815d29a5243c7f03714603d40d2 b/e6/0a06c703354815d29a5243c7f03714603d40d2
new file mode 100644 (file)
index 0000000..5213ba8
--- /dev/null
@@ -0,0 +1,187 @@
+Return-Path: <jani@nikula.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 olra.theworths.org (Postfix) with ESMTP id AC135431FBC\r
+       for <notmuch@notmuchmail.org>; Mon,  6 Feb 2012 11:57:35 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id y0CgQFvXVhNG for <notmuch@notmuchmail.org>;\r
+       Mon,  6 Feb 2012 11:57:31 -0800 (PST)\r
+Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com\r
+       [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id C8B54431FAF\r
+       for <notmuch@notmuchmail.org>; Mon,  6 Feb 2012 11:57:30 -0800 (PST)\r
+Received: by mail-lpp01m010-f53.google.com with SMTP id d3so3838995lah.26\r
+       for <notmuch@notmuchmail.org>; Mon, 06 Feb 2012 11:57:30 -0800 (PST)\r
+Received: by 10.112.49.201 with SMTP id w9mr5234450lbn.23.1328558250377;\r
+       Mon, 06 Feb 2012 11:57:30 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-fe50f800-253.dhcp.inet.fi.\r
+       [84.248.80.253])\r
+       by mx.google.com with ESMTPS id i9sm13798872lbz.3.2012.02.06.11.57.28\r
+       (version=SSLv3 cipher=OTHER); Mon, 06 Feb 2012 11:57:29 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 1/3] cli: use notmuch_bool_t for boolean fields in\r
+       notmuch_show_params_t\r
+Date: Mon,  6 Feb 2012 21:57:21 +0200\r
+Message-Id:\r
+ <dbebd4d256941d7e56e7c53582ed284d65365ace.1328558175.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.5.4\r
+In-Reply-To: <cover.1328558175.git.jani@nikula.org>\r
+References:\r
+ <df2e9bd7682e9c81e1b205cc1d92a1526cdd1a9b.1328308635.git.jani@nikula.org>\r
+       <cover.1328558175.git.jani@nikula.org>\r
+In-Reply-To: <cover.1328558175.git.jani@nikula.org>\r
+References: <cover.1328558175.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Mon, 06 Feb 2012 19:57:36 -0000\r
+\r
+Use notmuch_bool_t instead of int for entire_thread, raw, and decrypt\r
+boolean fields in notmuch_show_params_t. No functional changes.\r
+\r
+Signed-off-by: Jani Nikula <jani@nikula.org>\r
+---\r
+ notmuch-client.h |    6 +++---\r
+ notmuch-reply.c  |    7 +++----\r
+ notmuch-show.c   |   14 +++++++-------\r
+ 3 files changed, 13 insertions(+), 14 deletions(-)\r
+\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index e0eb594..60828aa 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -98,15 +98,15 @@ typedef struct notmuch_show_format {\r
+ } notmuch_show_format_t;\r
+ \r
+ typedef struct notmuch_show_params {\r
+-    int entire_thread;\r
+-    int raw;\r
++    notmuch_bool_t entire_thread;\r
++    notmuch_bool_t raw;\r
+     int part;\r
+ #ifdef GMIME_ATLEAST_26\r
+     GMimeCryptoContext* cryptoctx;\r
+ #else\r
+     GMimeCipherContext* cryptoctx;\r
+ #endif\r
+-    int decrypt;\r
++    notmuch_bool_t decrypt;\r
+ } notmuch_show_params_t;\r
+ \r
+ /* There's no point in continuing when we've detected that we've done\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index f55b1d2..6b244e6 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -661,7 +661,6 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
+     notmuch_show_params_t params = { .part = -1 };\r
+     int format = FORMAT_DEFAULT;\r
+     int reply_all = TRUE;\r
+-    notmuch_bool_t decrypt = FALSE;\r
+ \r
+     notmuch_opt_desc_t options[] = {\r
+       { NOTMUCH_OPT_KEYWORD, &format, "format", 'f',\r
+@@ -672,7 +671,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
+         (notmuch_keyword_t []){ { "all", TRUE },\r
+                                 { "sender", FALSE },\r
+                                 { 0, 0 } } },\r
+-      { NOTMUCH_OPT_BOOLEAN, &decrypt, "decrypt", 'd', 0 },\r
++      { NOTMUCH_OPT_BOOLEAN, &params.decrypt, "decrypt", 'd', 0 },\r
+       { 0, 0, 0, 0, 0 }\r
+     };\r
+ \r
+@@ -687,7 +686,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
+     else\r
+       reply_format_func = notmuch_reply_format_default;\r
+ \r
+-    if (decrypt) {\r
++    if (params.decrypt) {\r
+ #ifdef GMIME_ATLEAST_26\r
+       /* TODO: GMimePasswordRequestFunc */\r
+       params.cryptoctx = g_mime_gpg_context_new (NULL, "gpg");\r
+@@ -697,8 +696,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
+ #endif\r
+       if (params.cryptoctx) {\r
+           g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) params.cryptoctx, FALSE);\r
+-          params.decrypt = TRUE;\r
+       } else {\r
++          params.decrypt = FALSE;\r
+           fprintf (stderr, "Failed to construct gpg context.\n");\r
+       }\r
+ #ifndef GMIME_ATLEAST_26\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index dec799c..e04b3cc 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -1063,11 +1063,11 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+     int format_specified = 0;\r
+     int i;\r
+ \r
+-    params.entire_thread = 0;\r
+-    params.raw = 0;\r
++    params.entire_thread = FALSE;\r
++    params.raw = FALSE;\r
+     params.part = -1;\r
+     params.cryptoctx = NULL;\r
+-    params.decrypt = 0;\r
++    params.decrypt = FALSE;\r
+ \r
+     argc--; argv++; /* skip subcommand argument */\r
+ \r
+@@ -1082,13 +1082,13 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+               format = &format_text;\r
+           } else if (strcmp (opt, "json") == 0) {\r
+               format = &format_json;\r
+-              params.entire_thread = 1;\r
++              params.entire_thread = TRUE;\r
+           } else if (strcmp (opt, "mbox") == 0) {\r
+               format = &format_mbox;\r
+               mbox = 1;\r
+           } else if (strcmp (opt, "raw") == 0) {\r
+               format = &format_raw;\r
+-              params.raw = 1;\r
++              params.raw = TRUE;\r
+           } else {\r
+               fprintf (stderr, "Invalid value for --format: %s\n", opt);\r
+               return 1;\r
+@@ -1097,7 +1097,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+       } else if (STRNCMP_LITERAL (argv[i], "--part=") == 0) {\r
+           params.part = atoi(argv[i] + sizeof ("--part=") - 1);\r
+       } else if (STRNCMP_LITERAL (argv[i], "--entire-thread") == 0) {\r
+-          params.entire_thread = 1;\r
++          params.entire_thread = TRUE;\r
+       } else if ((STRNCMP_LITERAL (argv[i], "--verify") == 0) ||\r
+                  (STRNCMP_LITERAL (argv[i], "--decrypt") == 0)) {\r
+           if (params.cryptoctx == NULL) {\r
+@@ -1117,7 +1117,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+ #endif\r
+           }\r
+           if (STRNCMP_LITERAL (argv[i], "--decrypt") == 0)\r
+-              params.decrypt = 1;\r
++              params.decrypt = TRUE;\r
+       } else {\r
+           fprintf (stderr, "Unrecognized option: %s\n", argv[i]);\r
+           return 1;\r
+-- \r
+1.7.5.4\r
+\r