X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fthread.cc;h=4dcf7053c0fa76d558a89037908b557833d39506;hp=50bdef11aa8cba0f2240a142052a2ee249d74df1;hb=8fb16e277e4d6c32bafa79ae7967e1e6ba9258e0;hpb=f55b35b3df4d8708dfba0e95e33877305fd9f8d9 diff --git a/lib/thread.cc b/lib/thread.cc index 50bdef11..4dcf7053 100644 --- a/lib/thread.cc +++ b/lib/thread.cc @@ -227,7 +227,8 @@ _thread_cleanup_author (notmuch_thread_t *thread, static void _thread_add_message (notmuch_thread_t *thread, notmuch_message_t *message, - notmuch_string_list_t *exclude_terms) + notmuch_string_list_t *exclude_terms, + notmuch_exclude_t omit_exclude) { notmuch_tags_t *tags; const char *tag; @@ -235,6 +236,30 @@ _thread_add_message (notmuch_thread_t *thread, InternetAddress *address; const char *from, *author; char *clean_author; + notmuch_bool_t message_excluded = FALSE; + + if (omit_exclude != NOTMUCH_EXCLUDE_FALSE) { + for (tags = notmuch_message_get_tags (message); + notmuch_tags_valid (tags); + notmuch_tags_move_to_next (tags)) + { + tag = notmuch_tags_get (tags); + /* Is message excluded? */ + for (notmuch_string_node_t *term = exclude_terms->head; + term != NULL; + term = term->next) + { + /* We ignore initial 'K'. */ + if (strcmp(tag, (term->string + 1)) == 0) { + message_excluded = TRUE; + break; + } + } + } + } + + if (message_excluded && omit_exclude == NOTMUCH_EXCLUDE_ALL) + return; _notmuch_message_list_add_message (thread->message_list, talloc_steal (thread, message)); @@ -275,17 +300,12 @@ _thread_add_message (notmuch_thread_t *thread, notmuch_tags_move_to_next (tags)) { tag = notmuch_tags_get (tags); - /* Mark excluded messages. */ - for (notmuch_string_node_t *term = exclude_terms->head; term; - term = term->next) { - /* We ignore initial 'K'. */ - if (strcmp(tag, (term->string + 1)) == 0) { - notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, TRUE); - break; - } - } g_hash_table_insert (thread->tags, xstrdup (tag), NULL); } + + /* Mark excluded messages. */ + if (message_excluded) + notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, TRUE); } static void @@ -409,6 +429,7 @@ _notmuch_thread_create (void *ctx, unsigned int seed_doc_id, notmuch_doc_id_set_t *match_set, notmuch_string_list_t *exclude_terms, + notmuch_exclude_t omit_excluded, notmuch_sort_t sort) { void *local = talloc_new (ctx); @@ -488,7 +509,7 @@ _notmuch_thread_create (void *ctx, if (doc_id == seed_doc_id) message = seed_message; - _thread_add_message (thread, message, exclude_terms); + _thread_add_message (thread, message, exclude_terms, omit_excluded); if ( _notmuch_doc_id_set_contains (match_set, doc_id)) { _notmuch_doc_id_set_remove (match_set, doc_id);