]> git.notmuchmail.org Git - notmuch/blobdiff - database.cc
Merge branch to fix broken "notmuch setup" and "notmuch new"
[notmuch] / database.cc
index eab249910f39de927df3fe89eb17a4b43843db97..9831d79cdf912f50da160289268c1db504d6d836 100644 (file)
@@ -166,6 +166,8 @@ notmuch_status_to_string (notmuch_status_t status)
        return "Erroneous NULL pointer";
     case NOTMUCH_STATUS_TAG_TOO_LONG:
        return "Tag value is too long (exceeds NOTMUCH_TAG_MAX)";
+    case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW:
+       return "Unblanced number of calls to notmuch_message_freeze/thaw";
     default:
     case NOTMUCH_STATUS_LAST_STATUS:
        return "Unknown error status value";
@@ -821,7 +823,8 @@ _notmuch_database_link_message (notmuch_database_t *notmuch,
 
 notmuch_status_t
 notmuch_database_add_message (notmuch_database_t *notmuch,
-                             const char *filename)
+                             const char *filename,
+                             notmuch_message_t **message_ret)
 {
     notmuch_message_file_t *message_file;
     notmuch_message_t *message;
@@ -926,8 +929,13 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
     }
 
   DONE:
-    if (message)
-       notmuch_message_destroy (message);
+    if (message) {
+       if (message_ret)
+           *message_ret = message;
+       else
+           notmuch_message_destroy (message);
+    }
+
     if (message_file)
        notmuch_message_file_close (message_file);