mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
lib: add notmuch_message_count_files
This operation is relatively inexpensive, as the needed metadata is already computed by our lazy metadata fetching. The goal is to support better UI for messages with multipile files.
This commit is contained in:
parent
411675a6ce
commit
8a8e2b11c2
4 changed files with 28 additions and 0 deletions
|
@ -946,6 +946,14 @@ notmuch_message_get_filenames (notmuch_message_t *message)
|
|||
return _notmuch_filenames_create (message, message->filename_list);
|
||||
}
|
||||
|
||||
int
|
||||
notmuch_message_count_files (notmuch_message_t *message)
|
||||
{
|
||||
_notmuch_message_ensure_filename_list (message);
|
||||
|
||||
return _notmuch_string_list_length (message->filename_list);
|
||||
}
|
||||
|
||||
notmuch_bool_t
|
||||
notmuch_message_get_flag (notmuch_message_t *message,
|
||||
notmuch_message_flag_t flag)
|
||||
|
|
|
@ -550,6 +550,12 @@ typedef struct _notmuch_string_list {
|
|||
notmuch_string_list_t *
|
||||
_notmuch_string_list_create (const void *ctx);
|
||||
|
||||
/*
|
||||
* return the number of strings in 'list'
|
||||
*/
|
||||
int
|
||||
_notmuch_string_list_length (notmuch_string_list_t *list);
|
||||
|
||||
/* Add 'string' to 'list'.
|
||||
*
|
||||
* The list will create its own talloced copy of 'string'.
|
||||
|
|
|
@ -1341,6 +1341,14 @@ notmuch_message_get_thread_id (notmuch_message_t *message);
|
|||
notmuch_messages_t *
|
||||
notmuch_message_get_replies (notmuch_message_t *message);
|
||||
|
||||
/**
|
||||
* Get the total number of files associated with a message.
|
||||
* @returns Non-negative integer
|
||||
* @since libnotmuch 5.0 (notmuch 0.25)
|
||||
*/
|
||||
int
|
||||
notmuch_message_count_files (notmuch_message_t *message);
|
||||
|
||||
/**
|
||||
* Get a filename for the email corresponding to 'message'.
|
||||
*
|
||||
|
|
|
@ -42,6 +42,12 @@ _notmuch_string_list_create (const void *ctx)
|
|||
return list;
|
||||
}
|
||||
|
||||
int
|
||||
_notmuch_string_list_length (notmuch_string_list_t *list)
|
||||
{
|
||||
return list->length;
|
||||
}
|
||||
|
||||
void
|
||||
_notmuch_string_list_append (notmuch_string_list_t *list,
|
||||
const char *string)
|
||||
|
|
Loading…
Reference in a new issue