]> git.notmuchmail.org Git - notmuch/blobdiff - lib/message.cc
lib: Fix name reordering to handle commas without spaces
[notmuch] / lib / message.cc
index bbac2ffaf87da987b1c7f05244ce1caf801831c1..8720c1b542d839a24613991b4b425fe03f65e1e3 100644 (file)
@@ -462,9 +462,9 @@ notmuch_message_get_thread_id (notmuch_message_t *message)
 
 void
 _notmuch_message_add_reply (notmuch_message_t *message,
-                           notmuch_message_node_t *reply)
+                           notmuch_message_t *reply)
 {
-    _notmuch_message_list_append (message->replies, reply);
+    _notmuch_message_list_add_message (message->replies, reply);
 }
 
 notmuch_messages_t *
@@ -788,7 +788,9 @@ notmuch_message_get_tags (notmuch_message_t *message)
      * possible to modify the message tags (which talloc_unlink's the
      * current list from the message) while still iterating because
      * the iterator will keep the current list alive. */
-    talloc_reference (message, message->tag_list);
+    if (!talloc_reference (message, message->tag_list))
+       return NULL;
+
     return tags;
 }
 
@@ -1090,13 +1092,19 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)
            continue;
 
        flags = strstr (filename, ":2,");
-       if (! flags)
-           continue;
-
-       seen_maildir_info = 1;
-       flags += 3;
-
-       combined_flags = talloc_strdup_append (combined_flags, flags);
+       if (flags) {
+           seen_maildir_info = 1;
+           flags += 3;
+           combined_flags = talloc_strdup_append (combined_flags, flags);
+       } else if (STRNCMP_LITERAL (dir, "new/") == 0) {
+           /* Messages are delivered to new/ with no "info" part, but
+            * they effectively have default maildir flags.  According
+            * to the spec, we should ignore the info part for
+            * messages in new/, but some MUAs (mutt) can set maildir
+            * flags on messages in new/, so we're liberal in what we
+            * accept. */
+           seen_maildir_info = 1;
+       }
     }
 
     /* If none of the filenames have any maildir info field (not even