Re: [alot] announcing v0.3.3
[notmuch-archives.git] / 95 / 7d1b5ed9fbcf94a9b6a779100f955e3f00bc9f
1 Return-Path: <mpn@google.com>\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 582C7431FAF\r
6         for <notmuch@notmuchmail.org>; Thu,  6 Sep 2012 08:17:05 -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: -0.8\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.8 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         RCVD_IN_DNSWL_LOW=-0.7] 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 goBucuESRB3h for <notmuch@notmuchmail.org>;\r
17         Thu,  6 Sep 2012 08:17:01 -0700 (PDT)\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 2C406431FAE\r
22         for <notmuch@notmuchmail.org>; Thu,  6 Sep 2012 08:17:01 -0700 (PDT)\r
23 Received: by bkwj4 with SMTP id j4so953514bkw.26\r
24         for <notmuch@notmuchmail.org>; Thu, 06 Sep 2012 08:16:59 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\r
26  s=20120113;\r
27         h=from:to:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=M0Tf2mfG9Xi8C0sLnmZh9DkwZngUoOz/Juewb23UdU0=;\r
29         b=BpZzckzwDLfNseI88i7WV52XIUeh209ZXhwoX7fs69lvKHJUVa1+MfTrZZoV4ZDED5\r
30         fPFzG90x0IGeymWBubplHpJdTXuGkpc6dsydLnOpQ7TfgKlq8jvYky/aGzPni+vUSLCR\r
31         qrKUQipJDcBfIw/O34VubKsGMWUwzevLq5SFg3eQBoJkuLekL8xm9yxVabTlIKnXkESL\r
32         zx58iKuXcRtwoWDohOhZAlob3Ma6POf7CE6PjDQYthSOPtrQZma0OjdY8+5exAZvmsXH\r
33         vDu1IWUdDevYEnXA+ly7+T4g2VPoeCUxCbkUtWZwm6f5VvBZEpGzKZfXHZCahHylAwY/    a1gg==\r
34 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
35         d=google.com; s=20120113;\r
36         h=from:to:subject:date:message-id:x-mailer:in-reply-to:references\r
37         :x-gm-message-state;\r
38         bh=M0Tf2mfG9Xi8C0sLnmZh9DkwZngUoOz/Juewb23UdU0=;\r
39         b=IKVvnwIIfoXmfOWGDZ6moNgdgE7qvYsAuPvXSK2vywQs0ruMzMl30FIz/8YGA4Qb6q\r
40         jsLijCP0mVmRtstaTkYgIIY2wQZ/Qpfq6qdK8ZxDA+h1pJfHXEGJZj8LCh2qLP4zesbP\r
41         G9EWksBx2EWTINtV/j/yLrKw9S1cCUI0YNtPEjTw1YsewHzRVEok6hgtfM23PtQL2hif\r
42         kQ08ziTUrrPJpEfPqBGfqk4nzjCdBpZpJs9TlKpffxsHM/Gv6LFx9/CorzASi+1QmLQ1\r
43         YFiGue0b2a3FXtx1mHakyae0RS3r8YC7yHkrl1HkFscAGwASkccvtiYuKlAKZUoFuCXN\r
44         ppbg==\r
45 Received: by 10.204.148.72 with SMTP id o8mr1173588bkv.103.1346944619762;\r
46         Thu, 06 Sep 2012 08:16:59 -0700 (PDT)\r
47 Received: by 10.204.148.72 with SMTP id o8mr1173577bkv.103.1346944619505;\r
48         Thu, 06 Sep 2012 08:16:59 -0700 (PDT)\r
49 Received: from mpn-glaptop.corp.google.com.\r
50         (dhcp-172-16-75-154.zrh.corp.google.com [172.16.75.154])\r
51         by mx.google.com with ESMTPS id gq2sm1567294bkc.13.2012.09.06.08.16.57\r
52         (version=SSLv3 cipher=OTHER); Thu, 06 Sep 2012 08:16:58 -0700 (PDT)\r
53 From: Michal Nazarewicz <mpn@google.com>\r
54 To: notmuch@notmuchmail.org\r
55 Subject: [PATCH] notmuch-show: include Bcc header in json output\r
56 Date: Thu,  6 Sep 2012 17:16:52 +0200\r
57 Message-Id:\r
58  <821b9893f8b26cfe624568015c52c5b7753a9eac.1346944540.git.mina86@mina86.com>\r
59 X-Mailer: git-send-email 1.7.7.3\r
60 In-Reply-To:\r
61  <e07afdc98fd9517fba3060970b1150cef4d7ac80.1346881123.git.mina86@mina86.com>\r
62 References:\r
63  <e07afdc98fd9517fba3060970b1150cef4d7ac80.1346881123.git.mina86@mina86.com>\r
64 X-Gm-Message-State: ALoCoQnSdOnmSpHNuUVfOuDyuClcyGvuE/AEJCmfym1DLtWeGooBkgAOWptrn8P9yrl1f65JMF3M2tiOoKJJu4CajvLq8fEOr13KIQhCC6hUItzGBfqs3m5NRTJS9fV3V/CoaKU9LB2KDLqph91ViHZAm9RUunUjqgp4onWQq/V3vzmChEgjvtH6nCE8GcrTEUWm6kG9u0Kz2Q0KG6sNjgXJT0F36ZS/8w==\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Thu, 06 Sep 2012 15:17:05 -0000\r
78 \r
79 From: Michal Nazarewicz <mina86@mina86.com>\r
80 \r
81 ---\r
82  notmuch-show.c   |    7 +++++++\r
83  test/json        |    8 ++++----\r
84  test/test-lib.sh |    5 +++++\r
85  3 files changed, 16 insertions(+), 4 deletions(-)\r
86 \r
87 diff --git a/notmuch-show.c b/notmuch-show.c\r
88 index 3556293..0b7abf1 100644\r
89 --- a/notmuch-show.c\r
90 +++ b/notmuch-show.c\r
91 @@ -233,6 +233,13 @@ format_headers_json (sprinter_t *sp, GMimeMessage *message,\r
92         sp->string (sp, recipients_string);\r
93      }\r
94  \r
95 +    recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_BCC);\r
96 +    recipients_string = internet_address_list_to_string (recipients, 0);\r
97 +    if (recipients_string) {\r
98 +       sp->map_key (sp, "Bcc");\r
99 +       sp->string (sp, recipients_string);\r
100 +    }\r
101 +\r
102      if (reply) {\r
103         sp->map_key (sp, "In-reply-to");\r
104         sp->string (sp, g_mime_object_get_header (GMIME_OBJECT (message), "In-reply-to"));\r
105 diff --git a/test/json b/test/json\r
106 index ac8fa8e..40d0ba3 100755\r
107 --- a/test/json\r
108 +++ b/test/json\r
109 @@ -3,18 +3,18 @@ test_description="--format=json output"\r
110  . ./test-lib.sh\r
111  \r
112  test_begin_subtest "Show message: json"\r
113 -add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-show-message\""\r
114 +add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[body]=\"json-show-message\""\r
115  output=$(notmuch show --format=json "json-show-message")\r
116 -test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"\r
117 +test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"\r
118  \r
119  # This should be the same output as above.\r
120  test_begin_subtest "Show message: json --body=true"\r
121  output=$(notmuch show --format=json --body=true "json-show-message")\r
122 -test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"\r
123 +test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\",\"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"\r
124  \r
125  test_begin_subtest "Show message: json --body=false"\r
126  output=$(notmuch show --format=json --body=false "json-show-message")\r
127 -test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]"\r
128 +test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\",\"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]"\r
129  \r
130  test_begin_subtest "Search message: json"\r
131  add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-search-message\""\r
132 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
133 index f34b1fb..e14203d 100644\r
134 --- a/test/test-lib.sh\r
135 +++ b/test/test-lib.sh\r
136 @@ -350,6 +350,11 @@ ${additional_headers}"\r
137  ${additional_headers}"\r
138      fi\r
139  \r
140 +    if [ ! -z "${template[bcc]}" ]; then\r
141 +       additional_headers="Bcc: ${template[bcc]}\r
142 +${additional_headers}"\r
143 +    fi\r
144 +\r
145      if [ ! -z "${template[references]}" ]; then\r
146         additional_headers="References: ${template[references]}\r
147  ${additional_headers}"\r
148 -- \r
149 1.7.7.3\r
150 \r