X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fmessage.cc;h=531d304339a62e828a298f707e3517a9ead09519;hb=a378a91ba2db58608640cd58373565d653a7c4e6;hp=20b77580227b8c94a1b12b1a9e3cac050a2236ce;hpb=e4379c43e21ff69dcdb66064fe3de83ae0642fc0;p=notmuch diff --git a/lib/message.cc b/lib/message.cc index 20b77580..531d3043 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -822,6 +822,22 @@ _notmuch_message_sync (notmuch_message_t *message) db->replace_document (message->doc_id, message->doc); } +/* Delete a message document from the database. */ +notmuch_status_t +_notmuch_message_delete (notmuch_message_t *message) +{ + notmuch_status_t status; + Xapian::WritableDatabase *db; + + status = _notmuch_database_ensure_writable (message->notmuch); + if (status) + return status; + + db = static_cast (message->notmuch->xapian_db); + db->delete_document (message->doc_id); + return NOTMUCH_STATUS_SUCCESS; +} + /* Ensure that 'message' is not holding any file object open. Future * calls to various functions will still automatically open the * message file as needed.