prefix_t BOOLEAN_PREFIX_INTERNAL[] = {
{ "type", "T" },
- { "thread", "G" },
{ "ref", "XREFERENCE" },
{ "timestamp", "XTIMESTAMP" },
};
prefix_t BOOLEAN_PREFIX_EXTERNAL[] = {
+ { "thread", "G" },
{ "tag", "K" },
{ "id", "Q" }
};
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";
} catch (const Xapian::Error &error) {
fprintf (stderr, "A Xapian exception occurred: %s\n",
error.get_msg().c_str());
+ notmuch = NULL;
}
DONE:
void
notmuch_database_close (notmuch_database_t *notmuch)
{
+ notmuch->xapian_db->flush ();
+
delete notmuch->query_parser;
delete notmuch->xapian_db;
talloc_free (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;
const char *from, *to, *subject, *old_filename;
char *message_id;
+ if (message_ret)
+ *message_ret = NULL;
+
message_file = notmuch_message_file_open (filename);
if (message_file == NULL) {
ret = NOTMUCH_STATUS_FILE_ERROR;
}
DONE:
- if (message)
- notmuch_message_destroy (message);
+ if (message) {
+ if (ret == NOTMUCH_STATUS_SUCCESS && message_ret)
+ *message_ret = message;
+ else
+ notmuch_message_destroy (message);
+ }
+
if (message_file)
notmuch_message_file_close (message_file);