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 7DBBC6DE0227 for ; Fri, 20 Jul 2018 16:38:22 -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.010, 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 b1Ckx3LNiL1X for ; Fri, 20 Jul 2018 16:38:21 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id E1BB66DE026C for ; Fri, 20 Jul 2018 16:38:19 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1fgeyX-00024p-UB; Fri, 20 Jul 2018 19:38:17 -0400 Received: (nullmailer pid 2975 invoked by uid 1000); Fri, 20 Jul 2018 23:37:52 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 4/9] lib: read reference terms into message struct. Date: Sat, 21 Jul 2018 08:37:41 +0900 Message-Id: <20180720233746.2844-5-david@tethera.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180720233746.2844-1-david@tethera.net> References: <20180720233746.2844-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: Fri, 20 Jul 2018 23:38:22 -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 153e4bed..790d26f5 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; +} + notmuch_messages_t * notmuch_message_get_replies (notmuch_message_t *message) { diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index 499d73d4..e7bbc156 100644 --- a/lib/notmuch-private.h +++ b/lib/notmuch-private.h @@ -580,6 +580,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