1 Return-Path: <jani@nikula.org>
\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 03602431FB6
\r
6 for <notmuch@notmuchmail.org>; Thu, 17 Oct 2013 07:17:17 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 KYd1PwNmmAC1 for <notmuch@notmuchmail.org>;
\r
16 Thu, 17 Oct 2013 07:17:04 -0700 (PDT)
\r
17 Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com
\r
18 [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 5B6F8431FAE for <notmuch@notmuchmail.org>; Thu, 17 Oct 2013 07:17:04 -0700
\r
22 Received: by mail-ee0-f53.google.com with SMTP id t10so1084212eei.26
\r
23 for <notmuch@notmuchmail.org>; Thu, 17 Oct 2013 07:17:03 -0700 (PDT)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=1e100.net; s=20130820;
\r
26 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references
\r
27 :user-agent:date:message-id:mime-version:content-type;
\r
28 bh=WKr5XBJedjXYyxITlEMnrox6FTKqHUBfGmPY/ius0OM=;
\r
29 b=lKqoaDn55h0+l05N7t32zkdCYEYan9g3DTnrptEIxvM8lpZmXsiB0fYB6zAMuABXWp
\r
30 a7VdYxZSmM7eZ4g9fPGvrNczbOkIBJQCGE9GKaT3X5g+v0+w55tVvFfAb4EPK/2/uzIa
\r
31 OWBwJ08VUmBpVZD3KOLUzfICYCj/TEHwpR/0ZunPUPY2015DLkdv2uwLnK2ps6B/uFjR
\r
32 5V2eYnsEX6ynFLOTGtHomKHGdO0EzXxi1/PUfg4Z3wGhPRyJtn2w/hQv6BzBoqwGJaQh
\r
33 VljZufdOTLnLrPXgxRD1HFou4Xn5tagdnGY03nUKhXpQron0FgzqR3erbClrA6N8Z6yD
\r
36 ALoCoQmHKhgz5k2OUiZtYNy7G8mOlni60+Cs4qtil87c0SoDsqSxkMQwBxfL6pBQ6H6KJ2mEEhzd
\r
37 X-Received: by 10.15.98.9 with SMTP id bi9mr3986193eeb.67.1382019423188;
\r
38 Thu, 17 Oct 2013 07:17:03 -0700 (PDT)
\r
39 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.
\r
41 by mx.google.com with ESMTPSA id a1sm193403452eem.1.1969.12.31.16.00.00
\r
42 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
43 Thu, 17 Oct 2013 07:17:01 -0700 (PDT)
\r
44 From: Jani Nikula <jani@nikula.org>
\r
45 To: "Alexey I. Froloff" <raorn@raorn.name>, notmuch@notmuchmail.org
\r
46 Subject: Re: [PATCH] lib: Add a new prefix "list" to the search-terms syntax
\r
47 In-Reply-To: <1365549369-12776-1-git-send-email-raorn@raorn.name>
\r
48 References: <20130409083010.GA27675@raorn.name>
\r
49 <1365549369-12776-1-git-send-email-raorn@raorn.name>
\r
50 User-Agent: Notmuch/0.16+97~g6878b0b (http://notmuchmail.org) Emacs/24.3.1
\r
51 (x86_64-pc-linux-gnu)
\r
52 Date: Thu, 17 Oct 2013 17:17:00 +0300
\r
53 Message-ID: <87bo2ougmb.fsf@nikula.org>
\r
55 Content-Type: text/plain
\r
56 Cc: "Alexey I. Froloff" <raorn@raorn.name>
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Thu, 17 Oct 2013 14:17:17 -0000
\r
71 On Wed, 10 Apr 2013, "Alexey I. Froloff" <raorn@raorn.name> wrote:
\r
72 > From: "Alexey I. Froloff" <raorn@raorn.name>
\r
74 > Add support for indexing and searching the message's List-Id header.
\r
75 > This is useful when matching all the messages belonging to a particular
\r
78 There's an issue with our duplicate message-id handling that is likely
\r
79 to cause confusion with List-Id: searches. If you receive several
\r
80 duplicates of the same message (judged by the message-id), only the
\r
81 first one of them gets indexed, and the rest are ignored. This means
\r
82 that for messages you receive both directly and through a list, it will
\r
83 be arbitrary whether the List-Id: gets indexed or not. Therefore a list:
\r
84 search might not return all the messages you'd expect.
\r
90 > Rework of the patch by Pablo Oliveira <pablo@sifflez.org>
\r
92 > Differences from original patch:
\r
94 > The whole list ID indexed as boolean term, not split by words.
\r
95 > List description is not indexed at all.
\r
97 > Thanks to ojwb and amdragon from irc://irc.freenode.net/notmuch
\r
99 > Signed-off-by: Alexey I. Froloff <raorn@raorn.name>
\r
101 > lib/database.cc | 1 +
\r
102 > lib/index.cc | 45 ++++++++++++++++++++++++++++++++++++++++-
\r
103 > man/man7/notmuch-search-terms.7 | 8 ++++++++
\r
104 > 3 files changed, 53 insertions(+), 1 deletion(-)
\r
106 > diff --git a/lib/database.cc b/lib/database.cc
\r
107 > index 91d4329..6313913 100644
\r
108 > --- a/lib/database.cc
\r
109 > +++ b/lib/database.cc
\r
110 > @@ -203,6 +203,7 @@ static prefix_t BOOLEAN_PREFIX_INTERNAL[] = {
\r
113 > static prefix_t BOOLEAN_PREFIX_EXTERNAL[] = {
\r
114 > + { "list", "XLIST"},
\r
115 > { "thread", "G" },
\r
118 > diff --git a/lib/index.cc b/lib/index.cc
\r
119 > index a2edd6d..8b97ec3 100644
\r
120 > --- a/lib/index.cc
\r
121 > +++ b/lib/index.cc
\r
122 > @@ -304,6 +304,46 @@ _index_address_list (notmuch_message_t *message,
\r
127 > +_index_list_id (notmuch_message_t *message,
\r
128 > + const char *list_id_header)
\r
130 > + const char *begin_list_id, *end_list_id;
\r
132 > + if (list_id_header == NULL)
\r
135 > + /* RFC2919 says that the list-id is found at the end of the header
\r
136 > + * and enclosed between angle brackets. If we cannot find a
\r
137 > + * matching pair of brackets containing at least one character,
\r
138 > + * we ignore the list id header. */
\r
139 > + begin_list_id = strrchr (list_id_header, '<');
\r
140 > + if (!begin_list_id) {
\r
141 > + fprintf (stderr, "Warning: Not indexing mailformed List-Id tag.\n");
\r
145 > + end_list_id = strrchr(begin_list_id, '>');
\r
146 > + if (!end_list_id || (end_list_id - begin_list_id < 2)) {
\r
147 > + fprintf (stderr, "Warning: Not indexing mailformed List-Id tag.\n");
\r
151 > + void *local = talloc_new (message);
\r
153 > + /* We extract the list id between the angle brackets */
\r
154 > + const char *list_id = talloc_strndup (local, begin_list_id + 1,
\r
155 > + end_list_id - begin_list_id - 1);
\r
157 > + /* _notmuch_message_add_term() may return
\r
158 > + * NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG here. We can't fix it, but
\r
159 > + * this is not a reason to exit with error... */
\r
160 > + if (_notmuch_message_add_term (message, "list", list_id))
\r
161 > + fprintf (stderr, "Warning: Not indexing List-Id: <%s>\n", list_id);
\r
163 > + talloc_free (local);
\r
166 > /* Callback to generate terms for each mime part of a message. */
\r
168 > _index_mime_part (notmuch_message_t *message,
\r
169 > @@ -432,7 +472,7 @@ _notmuch_message_index_file (notmuch_message_t *message,
\r
170 > GMimeMessage *mime_message = NULL;
\r
171 > InternetAddressList *addresses;
\r
172 > FILE *file = NULL;
\r
173 > - const char *from, *subject;
\r
174 > + const char *from, *subject, *list_id;
\r
175 > notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
\r
176 > static int initialized = 0;
\r
177 > char from_buf[5];
\r
178 > @@ -500,6 +540,9 @@ mboxes is deprecated and may be removed in the future.\n", filename);
\r
179 > subject = g_mime_message_get_subject (mime_message);
\r
180 > _notmuch_message_gen_terms (message, "subject", subject);
\r
182 > + list_id = g_mime_object_get_header (GMIME_OBJECT (mime_message), "List-Id");
\r
183 > + _index_list_id (message, list_id);
\r
185 > _index_mime_part (message, g_mime_message_get_mime_part (mime_message));
\r
188 > diff --git a/man/man7/notmuch-search-terms.7 b/man/man7/notmuch-search-terms.7
\r
189 > index eb417ba..9cae107 100644
\r
190 > --- a/man/man7/notmuch-search-terms.7
\r
191 > +++ b/man/man7/notmuch-search-terms.7
\r
192 > @@ -52,6 +52,8 @@ terms to match against specific portions of an email, (where
\r
194 > thread:<thread-id>
\r
198 > folder:<directory-path>
\r
200 > date:<since>..<until>
\r
201 > @@ -100,6 +102,12 @@ thread ID values can be seen in the first column of output from
\r
202 > .B "notmuch search"
\r
206 > +is used to match mailing list ID of an email message \- contents of the
\r
207 > +List\-Id: header without the '<', '>' delimiters or decoded list
\r
212 > prefix can be used to search for email message files that are
\r
213 > contained within particular directories within the mail store. Only
\r
217 > _______________________________________________
\r
218 > notmuch mailing list
\r
219 > notmuch@notmuchmail.org
\r
220 > http://notmuchmail.org/mailman/listinfo/notmuch
\r