diff options
| author | David Bremner <david@tethera.net> | 2023-01-05 20:02:06 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2023-04-02 19:24:43 -0300 |
| commit | a554690d6af0ac8cb55166a20efd0f449abde389 (patch) | |
| tree | b852e9fe4b19ad6dbf3d49b731d82253151b8c5a /lib/database.cc | |
| parent | 3f5809bf28becbddfed9ff33d6f1242346904c23 (diff) | |
lib: index attachments with mime types matching index.as_text
Instead of skipping indexing all attachments, we check of a (user
configured) mime type that is indexable as text.
Diffstat (limited to 'lib/database.cc')
| -rw-r--r-- | lib/database.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/database.cc b/lib/database.cc index d1e5f1af..6987e2f4 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -1573,3 +1573,15 @@ notmuch_database_status_string (const notmuch_database_t *notmuch) { return notmuch->status_string; } + +bool +_notmuch_database_indexable_as_text (notmuch_database_t *notmuch, const char *mime_string) +{ + for (size_t i = 0; i < notmuch->index_as_text_length; i++) { + if (regexec (¬much->index_as_text[i], mime_string, 0, NULL, 0) == 0) { + return true; + } + } + + return false; +} |
