* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see http://www.gnu.org/licenses/ .
+ * along with this program. If not, see https://www.gnu.org/licenses/ .
*
* Author: Carl Worth <cworth@cworth.org>
*/
#define EMPTY_STRING(s) ((s)[0] == '\0')
-struct visible _notmuch_thread {
+struct _notmuch_thread {
notmuch_database_t *notmuch;
char *thread_id;
char *subject;
term != NULL;
term = term->next)
{
- /* We ignore initial 'K'. */
- if (strcmp(tag, (term->string + 1)) == 0) {
+ /* Check for an empty string, and then ignore initial 'K'. */
+ if (*(term->string) && strcmp(tag, (term->string + 1)) == 0) {
message_excluded = TRUE;
break;
}
{
time_t date;
notmuch_message_t *hashed_message;
- const char *cur_subject;
date = notmuch_message_get_date (message);
- cur_subject = notmuch_thread_get_subject(thread);
if (date < thread->oldest || ! thread->matched_messages) {
thread->oldest = date;
if (date > thread->newest || ! thread->matched_messages) {
thread->newest = date;
+ const char *cur_subject = notmuch_thread_get_subject(thread);
if (sort != NOTMUCH_SORT_OLDEST_FIRST || EMPTY_STRING(cur_subject))
_thread_set_subject_from_message (thread, message);
}
notmuch_messages_t *messages;
notmuch_message_t *message;
+ notmuch_status_t status;
seed_message = _notmuch_message_create (local, notmuch, seed_doc_id, NULL);
if (! seed_message)
* oldest or newest subject is desired. */
notmuch_query_set_sort (thread_id_query, NOTMUCH_SORT_OLDEST_FIRST);
- for (messages = notmuch_query_search_messages (thread_id_query);
+ status = notmuch_query_search_messages (thread_id_query, &messages);
+ if (status)
+ goto DONE;
+
+ for (;
notmuch_messages_valid (messages);
notmuch_messages_move_to_next (messages))
{