X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fthread.cc;h=cbce9c21528db21de4fca38ababfada0d2df79fd;hp=ffecc9d0d558822ca8a1c30566664d14e7cb1858;hb=54be14098ba8ece983f77200b5fdd10acb984c82;hpb=f7b49d658ad507b72d01b06d56975dba0b7cafc8 diff --git a/lib/thread.cc b/lib/thread.cc index ffecc9d0..cbce9c21 100644 --- a/lib/thread.cc +++ b/lib/thread.cc @@ -76,7 +76,6 @@ _thread_add_message (notmuch_thread_t *thread, { notmuch_tags_t *tags; const char *tag; - time_t date; InternetAddressList *list; InternetAddress *address; const char *from, *author; @@ -111,15 +110,24 @@ _thread_add_message (notmuch_thread_t *thread, g_hash_table_insert (thread->tags, xstrdup (tag), NULL); } + thread->total_messages++; +} + +static void +_thread_add_matched_message (notmuch_thread_t *thread, + notmuch_message_t *message) +{ + time_t date; + date = notmuch_message_get_date (message); - if (date < thread->oldest || ! thread->total_messages) + if (date < thread->oldest || ! thread->matched_messages) thread->oldest = date; - if (date > thread->newest || ! thread->total_messages) + if (date > thread->newest || ! thread->matched_messages) thread->newest = date; - thread->total_messages++; + thread->matched_messages++; } /* Create a new notmuch_thread_t object for the given thread ID, @@ -201,7 +209,7 @@ _notmuch_thread_create (void *ctx, notmuch_messages_has_more (messages); notmuch_messages_advance (messages)) { - thread->matched_messages++; + _thread_add_matched_message (thread, notmuch_messages_get (messages)); } notmuch_query_destroy (matched_query);