+ bool 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)
+ {
+ /* Check for an empty string, and then ignore initial 'K'. */
+ if (*(term->string) && strcmp(tag, (term->string + 1)) == 0) {
+ message_excluded = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (message_excluded && omit_exclude == NOTMUCH_EXCLUDE_ALL)
+ return;