]> git.notmuchmail.org Git - notmuch/blobdiff - lib/database.cc
lib: replace the header parser with gmime
[notmuch] / lib / database.cc
index aef748f75b5d61ca6f2f34c35a2af93d0bd81f70..1efb14d4a0bdc2327a366870069867ba392ad1aa 100644 (file)
@@ -1971,15 +1971,10 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
     if (ret)
        goto DONE;
 
-    notmuch_message_file_restrict_headers (message_file,
-                                          "date",
-                                          "from",
-                                          "in-reply-to",
-                                          "message-id",
-                                          "references",
-                                          "subject",
-                                          "to",
-                                          (char *) NULL);
+    /* Parse message up front to get better error status. */
+    ret = _notmuch_message_file_parse (message_file);
+    if (ret)
+       goto DONE;
 
     try {
        /* Before we do any real work, (especially before doing a
@@ -2066,7 +2061,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
            date = notmuch_message_file_get_header (message_file, "date");
            _notmuch_message_set_header_values (message, date, from, subject);
 
-           ret = _notmuch_message_index_file (message, filename);
+           ret = _notmuch_message_index_file (message, message_file);
            if (ret)
                goto DONE;
        } else {