proposal to remove contrib/notmuch-vim and contrib/notmuch-deliver
[notmuch-archives.git] / 3b / c7a678cda02a812669e018add7077cf9ee85c5
1 Return-Path: <sojkam1@fel.cvut.cz>\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 5761F4048F0\r
6         for <notmuch@notmuchmail.org>; Sun, 14 Mar 2010 13:44:24 -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: -2.211\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.211 tagged_above=-999 required=5 tests=[AWL=0.388,\r
12         BAYES_00=-2.599] autolearn=ham\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 DO-WG9r3RnRO for <notmuch@notmuchmail.org>;\r
16         Sun, 14 Mar 2010 13:44:23 -0700 (PDT)\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
18         by olra.theworths.org (Postfix) with ESMTP id 1EC61454968\r
19         for <notmuch@notmuchmail.org>; Sun, 14 Mar 2010 13:44:23 -0700 (PDT)\r
20 Received: from localhost (unknown [192.168.200.4])\r
21         by max.feld.cvut.cz (Postfix) with ESMTP id 85A7C19F35CC;\r
22         Sun, 14 Mar 2010 21:44:22 +0100 (CET)\r
23 X-Virus-Scanned: IMAP AMAVIS\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])\r
25         by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
26         port 10044)\r
27         with ESMTP id C3L-6dTk89pH; Sun, 14 Mar 2010 21:44:21 +0100 (CET)\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
29         by max.feld.cvut.cz (Postfix) with ESMTP id B8AC919F33BD;\r
30         Sun, 14 Mar 2010 21:44:20 +0100 (CET)\r
31 Received: from steelpick.localdomain (unknown [213.29.198.144])\r
32         (Authenticated sender: sojkam1)\r
33         by imap.feld.cvut.cz (Postfix) with ESMTPSA id 2A7ABFA003;\r
34         Sun, 14 Mar 2010 21:44:19 +0100 (CET)\r
35 Received: from wsh by steelpick.localdomain with local (Exim 4.71)\r
36         (envelope-from <sojkam1@fel.cvut.cz>)\r
37         id 1Nqufb-00055U-9V; Sun, 14 Mar 2010 21:44:19 +0100\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>\r
39 To: James Westby <jw+debian@jameswestby.net>, notmuch@notmuchmail.org,\r
40         Scott Robinson <scott@quadhome.com>\r
41 In-Reply-To: <87ociqbud3.fsf@jameswestby.net>\r
42 References: <87mxyabwha.fsf@steelpick.localdomain>\r
43         <1268590751-7478-1-git-send-email-sojkam1@fel.cvut.cz>\r
44         <87ociqbud3.fsf@jameswestby.net>\r
45 Date: Sun, 14 Mar 2010 21:44:18 +0100\r
46 Message-ID: <87ociqzl99.fsf@steelpick.localdomain>\r
47 MIME-Version: 1.0\r
48 Content-Type: text/plain; charset=us-ascii\r
49 Subject: [notmuch] [PATCH] Fix invalid JSON output for NULL strings\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Sun, 14 Mar 2010 20:44:24 -0000\r
63 \r
64 On Sun, 14 Mar 2010 15:01:28 -0400, James Westby <jw+debian@jameswestby.net> wrote:\r
65 > On Sun, 14 Mar 2010 19:19:11 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote:\r
66 > > Mails with empty body produced the following output:\r
67 > >   "body": [{"id": 1, "content-type": "text/plain", "content": (null)}]\r
68 > > The (null) is not valid JSON syntax.\r
69\r
70 > Is this just something that can happen with the body?\r
71\r
72 > I've see (null) in the emacs interface when I've done something silly\r
73 > such as opening a newer notmuch db with an old client.\r
74\r
75 > Should all the attributes be guarded in a similar manner to ensure valid\r
76 > JSON?\r
77 \r
78 \r
79 You're right. When you import messages from mail archive such as\r
80 http://notmuchmail.org/pipermail/notmuch/, there are no To: headers.\r
81 This case is already handled by the current code, but what about this\r
82 more universal solution? It also solves my problem with notmuchsynch.\r
83 \r
84 -- >8 --\r
85 Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>\r
86 ---\r
87  json.c |    2 +-\r
88  1 files changed, 1 insertions(+), 1 deletions(-)\r
89 \r
90 diff --git a/json.c b/json.c\r
91 index 9614143..0885d3d 100644\r
92 --- a/json.c\r
93 +++ b/json.c\r
94 @@ -56,7 +56,7 @@ json_quote_str(const void *ctx, const char *str)\r
95      int len = 0;\r
96  \r
97      if (!str)\r
98 -       return NULL;\r
99 +       return (char*)"null";\r
100  \r
101      for (ptr = str; *ptr; len++, ptr++) {\r
102         if (*ptr < 32 || *ptr == '\"' || *ptr == '\\')\r
103 -- \r
104 1.7.0\r
105 \r