X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fmessage.cc;h=da4a102c3fc1c10f171d837bffa7707b416f81b4;hp=25afd85b0d00a1a9143b24a259b43c83de8161eb;hb=206938ec9b4ddee28793f2f052a5314d6d7ab08d;hpb=d9b0ae918fd9d535e819b8859eca579002146661 diff --git a/lib/message.cc b/lib/message.cc index 25afd85b..da4a102c 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -32,7 +32,7 @@ struct _notmuch_message { char *message_id; char *thread_id; char *in_reply_to; - notmuch_filename_list_t *filename_list; + notmuch_string_list_t *filename_list; char *author; notmuch_message_file_t *message_file; notmuch_message_list_t *replies; @@ -440,7 +440,7 @@ _notmuch_message_add_filename (notmuch_message_t *message, INTERNAL_ERROR ("Message filename cannot be NULL."); if (message->filename_list) { - _notmuch_filename_list_destroy (message->filename_list); + talloc_free (message->filename_list); message->filename_list = NULL; } @@ -492,7 +492,7 @@ _notmuch_message_remove_filename (notmuch_message_t *message, Xapian::TermIterator i, last; if (message->filename_list) { - _notmuch_filename_list_destroy (message->filename_list); + talloc_free (message->filename_list); message->filename_list = NULL; } @@ -582,7 +582,7 @@ _notmuch_message_ensure_filename_list (notmuch_message_t *message) if (message->filename_list) return; - message->filename_list = _notmuch_filename_list_create (message); + message->filename_list = _notmuch_string_list_create (message); i = message->doc.termlist_begin (); i.skip_to (prefix); @@ -603,7 +603,7 @@ _notmuch_message_ensure_filename_list (notmuch_message_t *message) if (data == NULL) INTERNAL_ERROR ("message with no filename"); - _notmuch_filename_list_add_filename (message->filename_list, data); + _notmuch_string_list_append (message->filename_list, data); return; } @@ -644,8 +644,7 @@ _notmuch_message_ensure_filename_list (notmuch_message_t *message) filename = talloc_asprintf (message, "%s/%s", db_path, basename); - _notmuch_filename_list_add_filename (message->filename_list, - filename); + _notmuch_string_list_append (message->filename_list, filename); talloc_free (local); } @@ -660,12 +659,12 @@ notmuch_message_get_filename (notmuch_message_t *message) return NULL; if (message->filename_list->head == NULL || - message->filename_list->head->filename == NULL) + message->filename_list->head->string == NULL) { INTERNAL_ERROR ("message with no filename"); } - return message->filename_list->head->filename; + return message->filename_list->head->string; } notmuch_filenames_t * @@ -712,9 +711,13 @@ notmuch_tags_t * notmuch_message_get_tags (notmuch_message_t *message) { Xapian::TermIterator i, end; + notmuch_string_list_t *tags; i = message->doc.termlist_begin(); end = message->doc.termlist_end(); - return _notmuch_convert_tags(message, i, end); + tags = _notmuch_database_get_terms_with_prefix (message, i, end, + _find_prefix ("tag")); + _notmuch_string_list_sort (tags); + return _notmuch_tags_create (message, tags); } const char *