notmuch search and tags
[notmuch-archives.git] / 84 / a70154e2970e5990f9aa4c6811e1cc91ab2e78
1 Return-Path: <bart@jukie.net>\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 0D0DB431FAE\r
6         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 20:55:20 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id WsPasMks4Yon for <notmuch@notmuchmail.org>;\r
11         Tue, 24 Nov 2009 20:55:19 -0800 (PST)\r
12 Received: from tau.jukie.net (tau.jukie.net [216.239.93.128])\r
13         by olra.theworths.org (Postfix) with ESMTP id 69F66431FBF\r
14         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 20:55:18 -0800 (PST)\r
15 Received: from localhost.localdomain (oxygen.jukie.net [10.10.10.8])\r
16         by tau.jukie.net (Postfix) with ESMTP id E1721C00F85;\r
17         Tue, 24 Nov 2009 23:55:17 -0500 (EST)\r
18 From: Bart Trojanowski <bart@jukie.net>\r
19 To: notmuch@notmuchmail.org\r
20 Date: Tue, 24 Nov 2009 23:54:34 -0500\r
21 Message-Id: <1259124875-28212-3-git-send-email-bart@jukie.net>\r
22 X-Mailer: git-send-email 1.6.4.4.2.gc2f148\r
23 In-Reply-To: <1259124875-28212-2-git-send-email-bart@jukie.net>\r
24 References: <1259124875-28212-1-git-send-email-bart@jukie.net>\r
25         <1259124875-28212-2-git-send-email-bart@jukie.net>\r
26 Cc: Bart Trojanowski <bart@jukie.net>\r
27 Subject: [notmuch] [PATCH 2/3] have _notmuch_thread_create mark which\r
28         messages matched the query\r
29 X-BeenThere: notmuch@notmuchmail.org\r
30 X-Mailman-Version: 2.1.12\r
31 Precedence: list\r
32 List-Id: "Use and development of the notmuch mail system."\r
33         <notmuch.notmuchmail.org>\r
34 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
35         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
36 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
37 List-Post: <mailto:notmuch@notmuchmail.org>\r
38 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
39 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
40         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
41 X-List-Received-Date: Wed, 25 Nov 2009 04:55:20 -0000\r
42 \r
43 When _notmuch_thread_create() is given a query string, it can return more\r
44 messages than just those matching the query.  To distinguish those that\r
45 matched the query expression, the MATCHING_SEARCH flag is set\r
46 appropriately.\r
47 \r
48 Signed-off-by: Bart Trojanowski <bart@jukie.net>\r
49 ---\r
50  lib/notmuch.h |    1 +\r
51  lib/thread.cc |    8 ++++++++\r
52  2 files changed, 9 insertions(+), 0 deletions(-)\r
53 \r
54 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
55 index c232c58..3974820 100644\r
56 --- a/lib/notmuch.h\r
57 +++ b/lib/notmuch.h\r
58 @@ -686,6 +686,7 @@ notmuch_message_get_filename (notmuch_message_t *message);\r
59  \r
60  /* Message flags */\r
61  typedef enum _notmuch_message_flag {\r
62 +    NOTMUCH_MSG_FLAG_MATCHING_SEARCH,\r
63  } notmuch_message_flag_t;\r
64  \r
65  /* Get a value of a flag for the email corresponding to 'message'. */\r
66 diff --git a/lib/thread.cc b/lib/thread.cc\r
67 index 58d88c2..9e4cb5c 100644\r
68 --- a/lib/thread.cc\r
69 +++ b/lib/thread.cc\r
70 @@ -132,6 +132,7 @@ _thread_add_matched_message (notmuch_thread_t *thread,\r
71                              notmuch_message_t *message)\r
72  {\r
73      time_t date;\r
74 +    notmuch_message_t *hashed_message;\r
75  \r
76      date = notmuch_message_get_date (message);\r
77  \r
78 @@ -142,6 +143,13 @@ _thread_add_matched_message (notmuch_thread_t *thread,\r
79         thread->newest = date;\r
80  \r
81      thread->matched_messages++;\r
82 +\r
83 +    if (g_hash_table_lookup_extended (thread->message_hash,\r
84 +                           notmuch_message_get_message_id (message), NULL,\r
85 +                           (void **) &hashed_message)) {\r
86 +       notmuch_message_set_flag (hashed_message,\r
87 +                       NOTMUCH_MSG_FLAG_MATCHING_SEARCH, 1);\r
88 +    }\r
89  }\r
90  \r
91  static void\r
92 -- \r
93 1.6.4.4.2.gc2f148\r
94 \r