- notmuch_tags_t *tags;
-
- tags = talloc (message, notmuch_tags_t);
- if (unlikely (tags == NULL))
- return NULL;
-
- new (&tags->iterator) Xapian::TermIterator;
- new (&tags->iterator_end) Xapian::TermIterator;
-
- talloc_set_destructor (tags, _notmuch_tags_destructor);
-
- tags->iterator = message->doc.termlist_begin ();
- tags->iterator.skip_to (_find_prefix ("tag"));
- tags->iterator_end = message->doc.termlist_end ();
-
- return tags;
-}
-
-notmuch_thread_ids_t *
-notmuch_message_get_thread_ids (notmuch_message_t *message)
-{
- notmuch_thread_ids_t *thread_ids;
- std::string id_str;
-
- thread_ids = talloc (message, notmuch_thread_ids_t);
- if (unlikely (thread_ids == NULL))
- return NULL;
-
- id_str = message->doc.get_value (NOTMUCH_VALUE_THREAD);
- thread_ids->next = talloc_strdup (message, id_str.c_str ());
-
- /* Initialize thread_ids->current and terminate first ID. */
- notmuch_thread_ids_advance (thread_ids);
-
- return thread_ids;
+ return _notmuch_terms_create_type (message, message->doc, "tag",
+ notmuch_tags_t);