X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fthread.cc;h=50bdef11aa8cba0f2240a142052a2ee249d74df1;hb=268666a071db33c5ce6a01b052d9a19c184e10f6;hp=45a7d1d023dcdb4b86395475e752760ca2c6a6eb;hpb=5394924e6cf8f4758fdfb748b8b28b7ef9165ce7;p=notmuch diff --git a/lib/thread.cc b/lib/thread.cc index 45a7d1d0..50bdef11 100644 --- a/lib/thread.cc +++ b/lib/thread.cc @@ -190,8 +190,16 @@ _thread_cleanup_author (notmuch_thread_t *thread, if (comma && strlen(comma) > 1) { /* let's assemble what we think is the correct name */ lname = comma - author; - fname = strlen(author) - lname - 2; - strncpy(clean_author, comma + 2, fname); + + /* Skip all the spaces after the comma */ + fname = strlen(author) - lname - 1; + comma += 1; + while (*comma == ' ') { + fname -= 1; + comma += 1; + } + strncpy(clean_author, comma, fname); + *(clean_author+fname) = ' '; strncpy(clean_author + fname + 1, author, lname); *(clean_author+fname+1+lname) = '\0'; @@ -508,6 +516,12 @@ notmuch_thread_get_toplevel_messages (notmuch_thread_t *thread) return _notmuch_messages_create (thread->toplevel_list); } +notmuch_messages_t * +notmuch_thread_get_messages (notmuch_thread_t *thread) +{ + return _notmuch_messages_create (thread->message_list); +} + const char * notmuch_thread_get_thread_id (notmuch_thread_t *thread) {