Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 42 / 3dc9e809601759aab67a9697a86a63e3710382
1 Return-Path: <bremner@tesseract.cs.unb.ca>\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 arlo.cworth.org (Postfix) with ESMTP id 79E566DE1B83\r
6  for <notmuch@notmuchmail.org>; Sun,  5 Apr 2015 16:01:36 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.564\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.564 tagged_above=-999 required=5 tests=[AWL=0.554, \r
12  T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id bfzld1fAu9Lw for <notmuch@notmuchmail.org>;\r
16  Sun,  5 Apr 2015 16:01:34 -0700 (PDT)\r
17 Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net\r
18  [87.98.215.224])\r
19  by arlo.cworth.org (Postfix) with ESMTPS id B0A006DE1B72\r
20  for <notmuch@notmuchmail.org>; Sun,  5 Apr 2015 16:01:34 -0700 (PDT)\r
21 Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim\r
22  4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)\r
23  id 1YetXA-0002om-S7; Sun, 05 Apr 2015 23:00:52 +0000\r
24 Received: (nullmailer pid 2243 invoked by uid 1000); Sun, 05 Apr 2015\r
25  22:59:25 -0000\r
26 From: David Bremner <david@tethera.net>\r
27 To: notmuch@notmuchmail.org\r
28 Subject: [WIP2 04/12] cli: add type introspection to sprinter type\r
29 Date: Mon,  6 Apr 2015 07:59:06 +0900\r
30 Message-Id: <1428274754-1698-5-git-send-email-david@tethera.net>\r
31 X-Mailer: git-send-email 2.1.4\r
32 In-Reply-To: <1428274754-1698-1-git-send-email-david@tethera.net>\r
33 References: <1428274754-1698-1-git-send-email-david@tethera.net>\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.18\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38  <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
40  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
45  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Sun, 05 Apr 2015 23:01:36 -0000\r
47 \r
48 This will make it easier to skip generating certain output for the\r
49 text format.\r
50 ---\r
51  sprinter-json.c |  1 +\r
52  sprinter-sexp.c |  1 +\r
53  sprinter-text.c |  1 +\r
54  sprinter.h      | 10 ++++++++++\r
55  4 files changed, 13 insertions(+)\r
56 \r
57 diff --git a/sprinter-json.c b/sprinter-json.c\r
58 index 0a07790..8e5ffbe 100644\r
59 --- a/sprinter-json.c\r
60 +++ b/sprinter-json.c\r
61 @@ -175,6 +175,7 @@ sprinter_json_create (const void *ctx, FILE *stream)\r
62  {\r
63      static const struct sprinter_json template = {\r
64         .vtable = {\r
65 +           .type = NOTMUCH_SPRINTER_JSON,\r
66             .begin_map = json_begin_map,\r
67             .begin_list = json_begin_list,\r
68             .end = json_end,\r
69 diff --git a/sprinter-sexp.c b/sprinter-sexp.c\r
70 index 0aa51e8..e187c05 100644\r
71 --- a/sprinter-sexp.c\r
72 +++ b/sprinter-sexp.c\r
73 @@ -210,6 +210,7 @@ sprinter_sexp_create (const void *ctx, FILE *stream)\r
74  {\r
75      static const struct sprinter_sexp template = {\r
76         .vtable = {\r
77 +           .type = NOTMUCH_SPRINTER_SEXP,\r
78             .begin_map = sexp_begin_map,\r
79             .begin_list = sexp_begin_list,\r
80             .end = sexp_end,\r
81 diff --git a/sprinter-text.c b/sprinter-text.c\r
82 index 7779488..cd6cd56 100644\r
83 --- a/sprinter-text.c\r
84 +++ b/sprinter-text.c\r
85 @@ -117,6 +117,7 @@ sprinter_text_create (const void *ctx, FILE *stream)\r
86  {\r
87      static const struct sprinter_text template = {\r
88         .vtable = {\r
89 +           .type = NOTMUCH_SPRINTER_TEXT,\r
90             .begin_map = text_begin_map,\r
91             .begin_list = text_begin_list,\r
92             .end = text_end,\r
93 diff --git a/sprinter.h b/sprinter.h\r
94 index f859672..7e58f69 100644\r
95 --- a/sprinter.h\r
96 +++ b/sprinter.h\r
97 @@ -4,11 +4,21 @@\r
98  /* Necessary for notmuch_bool_t */\r
99  #include "notmuch-client.h"\r
100  \r
101 +enum notmuch_sprinter_type {\r
102 +    NOTMUCH_SPRINTER_JSON,\r
103 +    NOTMUCH_SPRINTER_SEXP,\r
104 +    NOTMUCH_SPRINTER_TEXT\r
105 +};\r
106 +\r
107  /* Structure printer interface. This is used to create output\r
108   * structured as maps (with key/value pairs), lists and primitives\r
109   * (strings, integers and booleans).\r
110   */\r
111  typedef struct sprinter {\r
112 +    /* Identify the type of sprinter\r
113 +     */\r
114 +    enum notmuch_sprinter_type type;\r
115 +\r
116      /* Start a new map/dictionary structure. This should be followed by\r
117       * a sequence of alternating calls to map_key and one of the\r
118       * value-printing functions until the map is ended by end.\r
119 -- \r
120 2.1.4\r
121 \r