From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 2BFED6DE031B for ; Mon, 30 Jul 2018 15:47:10 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.001 X-Spam-Level: X-Spam-Status: No, score=0.001 tagged_above=-999 required=5 tests=[AWL=0.012, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WPQNk6WF6Z7A for ; Mon, 30 Jul 2018 15:47:09 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 056296DE0286 for ; Mon, 30 Jul 2018 15:47:07 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1fkGwV-0002FT-5w; Mon, 30 Jul 2018 18:47:07 -0400 Received: (nullmailer pid 28729 invoked by uid 1000); Mon, 30 Jul 2018 22:45:56 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 05/15] lib: read reference terms into message struct. Date: Tue, 31 Jul 2018 06:45:45 +0800 Message-Id: <20180730224555.26047-6-david@tethera.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180730224555.26047-1-david@tethera.net> References: <20180730224555.26047-1-david@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jul 2018 22:47:10 -0000 The plan is to use these in resolving threads. --- lib/message.cc | 17 +++++++++++++++++ lib/notmuch-private.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/lib/message.cc b/lib/message.cc index 107dcf35..db5ce0a2 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -41,6 +41,7 @@ struct _notmuch_message { notmuch_message_file_t *message_file; notmuch_string_list_t *property_term_list; notmuch_string_map_t *property_map; + notmuch_string_list_t *reference_list; notmuch_message_list_t *replies; unsigned long flags; /* For flags that are initialized on-demand, lazy_flags indicates @@ -129,6 +130,7 @@ _notmuch_message_create_for_document (const void *talloc_owner, message->author = NULL; message->property_term_list = NULL; message->property_map = NULL; + message->reference_list = NULL; message->replies = _notmuch_message_list_create (message); if (unlikely (message->replies == NULL)) { @@ -349,6 +351,7 @@ _notmuch_message_ensure_metadata (notmuch_message_t *message, void *field) *type_prefix = _find_prefix ("type"), *filename_prefix = _find_prefix ("file-direntry"), *property_prefix = _find_prefix ("property"), + *reference_prefix = _find_prefix ("reference"), *replyto_prefix = _find_prefix ("replyto"); /* We do this all in a single pass because Xapian decompresses the @@ -413,6 +416,14 @@ _notmuch_message_ensure_metadata (notmuch_message_t *message, void *field) _notmuch_database_get_terms_with_prefix (message, i, end, property_prefix); + /* get references */ + assert (strcmp (property_prefix, reference_prefix) < 0); + if (!message->reference_list) { + message->reference_list = + _notmuch_database_get_terms_with_prefix (message, i, end, + reference_prefix); + } + /* Get reply to */ assert (strcmp (property_prefix, replyto_prefix) < 0); if (!message->in_reply_to) @@ -588,6 +599,12 @@ _notmuch_message_add_reply (notmuch_message_t *message, _notmuch_message_list_add_message (message->replies, reply); } +const notmuch_string_list_t * +_notmuch_message_get_references (notmuch_message_t *message) +{ + return message->reference_list; +} + static int _cmpmsg (const void *pa, const void *pb) { diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index 10bb7040..7603e1f4 100644 --- a/lib/notmuch-private.h +++ b/lib/notmuch-private.h @@ -583,6 +583,9 @@ _notmuch_string_list_append (notmuch_string_list_t *list, void _notmuch_string_list_sort (notmuch_string_list_t *list); +const notmuch_string_list_t * +_notmuch_message_get_references(notmuch_message_t *message); + /* string-map.c */ typedef struct _notmuch_string_map notmuch_string_map_t; typedef struct _notmuch_string_map_iterator notmuch_string_map_iterator_t; -- 2.18.0