}
static void
-_notmuch_message_ensure_metadata (notmuch_message_t *message)
+_notmuch_message_ensure_metadata (notmuch_message_t *message, void *field)
{
Xapian::TermIterator i, end;
+ if (field && (message->last_view >= message->notmuch->view))
+ return;
+
const char *thread_prefix = _find_prefix ("thread"),
*tag_prefix = _find_prefix ("tag"),
*id_prefix = _find_prefix ("id"),
const char *
notmuch_message_get_message_id (notmuch_message_t *message)
{
- if (!message->message_id)
- _notmuch_message_ensure_metadata (message);
+ _notmuch_message_ensure_metadata (message, message->message_id);
if (!message->message_id)
INTERNAL_ERROR ("Message with document ID of %u has no message ID.\n",
message->doc_id);
const char *
_notmuch_message_get_in_reply_to (notmuch_message_t *message)
{
- if (!message->in_reply_to)
- _notmuch_message_ensure_metadata (message);
+ _notmuch_message_ensure_metadata (message, message->in_reply_to);
return message->in_reply_to;
}
const char *
notmuch_message_get_thread_id (notmuch_message_t *message)
{
- if (!message->thread_id)
- _notmuch_message_ensure_metadata (message);
+ _notmuch_message_ensure_metadata (message, message->thread_id);
if (!message->thread_id)
INTERNAL_ERROR ("Message with document ID of %u has no thread ID.\n",
message->doc_id);
if (message->filename_list)
return;
- if (!message->filename_term_list)
- _notmuch_message_ensure_metadata (message);
+ _notmuch_message_ensure_metadata (message, message->filename_term_list);
message->filename_list = _notmuch_string_list_create (message);
node = message->filename_term_list->head;
{
if (flag == NOTMUCH_MESSAGE_FLAG_GHOST &&
! NOTMUCH_TEST_BIT (message->lazy_flags, flag))
- _notmuch_message_ensure_metadata (message);
+ _notmuch_message_ensure_metadata (message, NULL);
return NOTMUCH_TEST_BIT (message->flags, flag);
}
{
notmuch_tags_t *tags;
- if (!message->tag_list)
- _notmuch_message_ensure_metadata (message);
+ _notmuch_message_ensure_metadata (message, message->tag_list);
tags = _notmuch_tags_create (message, message->tag_list);
/* _notmuch_tags_create steals the reference to the tag_list, but
if (message->property_map)
return;
- if (!message->property_term_list)
- _notmuch_message_ensure_metadata (message);
+ _notmuch_message_ensure_metadata (message, message->property_term_list);
message->property_map = _notmuch_string_map_create (message);