Re: [PATCH v4 08/16] reorganize indexing of multipart/signed and multipart/encrypted
[notmuch-archives.git] / 1f / aa2656fb526eb08b73f76498ae34971bf5b311
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 olra.theworths.org (Postfix) with ESMTP id 82675429E3E\r
6         for <notmuch@notmuchmail.org>; Sun, 28 Dec 2014 09:38:07 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\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 JYEtPlrDfOvZ for <notmuch@notmuchmail.org>;\r
16         Sun, 28 Dec 2014 09:38:05 -0800 (PST)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id F1410429E34\r
21         for <notmuch@notmuchmail.org>; Sun, 28 Dec 2014 09:38:03 -0800 (PST)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tesseract.cs.unb.ca>)\r
24         id 1Y5Hn1-0002fz-Jv; Sun, 28 Dec 2014 13:38:03 -0400\r
25 Received: (nullmailer pid 11496 invoked by uid 1000); Sun, 28 Dec 2014\r
26         17:37:40 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [Patch v3 2/6] lib/database: add field for last error string\r
30 Date: Sun, 28 Dec 2014 18:33:46 +0100\r
31 Message-Id: <1419788030-10567-3-git-send-email-david@tethera.net>\r
32 X-Mailer: git-send-email 2.1.3\r
33 In-Reply-To: <1419788030-10567-1-git-send-email-david@tethera.net>\r
34 References: <1419788030-10567-1-git-send-email-david@tethera.net>\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.13\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39         <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Sun, 28 Dec 2014 17:38:07 -0000\r
48 \r
49 The idea is to have a logging function setting this string instead of\r
50 printing to stderr.\r
51 ---\r
52  lib/database-private.h | 4 ++++\r
53  lib/database.cc        | 7 +++++++\r
54  lib/notmuch.h          | 7 +++++++\r
55  3 files changed, 18 insertions(+)\r
56 \r
57 diff --git a/lib/database-private.h b/lib/database-private.h\r
58 index 15e03cc..7efd98b 100644\r
59 --- a/lib/database-private.h\r
60 +++ b/lib/database-private.h\r
61 @@ -146,6 +146,10 @@ struct _notmuch_database {\r
62      unsigned int last_doc_id;\r
63      uint64_t last_thread_id;\r
64  \r
65 +    /* error reporting; this value persists only until the\r
66 +     * next library call. May be NULL */\r
67 +    char *status_string;\r
68 +\r
69      Xapian::QueryParser *query_parser;\r
70      Xapian::TermGenerator *term_gen;\r
71      Xapian::ValueRangeProcessor *value_range_processor;\r
72 diff --git a/lib/database.cc b/lib/database.cc\r
73 index 4f4e871..18db902 100644\r
74 --- a/lib/database.cc\r
75 +++ b/lib/database.cc\r
76 @@ -858,6 +858,7 @@ notmuch_database_open_verbose (const char *path,\r
77  \r
78      notmuch = talloc_zero (NULL, notmuch_database_t);\r
79      notmuch->exception_reported = FALSE;\r
80 +    notmuch->status_string = NULL;\r
81      notmuch->path = talloc_strdup (notmuch, path);\r
82  \r
83      if (notmuch->path[strlen (notmuch->path) - 1] == '/')\r
84 @@ -2543,3 +2544,9 @@ notmuch_database_get_all_tags (notmuch_database_t *db)\r
85         return NULL;\r
86      }\r
87  }\r
88 +\r
89 +const char *\r
90 +notmuch_database_status_string (notmuch_database_t *notmuch)\r
91 +{\r
92 +    return notmuch->status_string;\r
93 +}\r
94 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
95 index 0dfac8f..2ab2998 100644\r
96 --- a/lib/notmuch.h\r
97 +++ b/lib/notmuch.h\r
98 @@ -302,6 +302,13 @@ notmuch_database_open_verbose (const char *path,\r
99                                char **error_message);\r
100  \r
101  /**\r
102 + * Retrieve last status string for given database.\r
103 + *\r
104 + */\r
105 +const char *\r
106 +notmuch_database_status_string (notmuch_database_t *notmuch);\r
107 +\r
108 +/**\r
109   * Commit changes and close the given notmuch database.\r
110   *\r
111   * After notmuch_database_close has been called, calls to other\r
112 -- \r
113 2.1.3\r
114 \r