-/* Change the message filename stored in the database.
- *
- * This change will not be reflected in the database until the next
- * call to _notmuch_message_sync.
- */
-notmuch_status_t
-_notmuch_message_rename (notmuch_message_t *message,
- const char *new_filename)
-{
- void *local = talloc_new (message);
- char *direntry;
- Xapian::PostingIterator i, end;
- Xapian::Document document;
- notmuch_private_status_t private_status;
- notmuch_status_t status;
- const char *old_filename;
-
- old_filename = notmuch_message_get_filename(message);
- old_filename = talloc_reference(local, old_filename);
- if (unlikely (! old_filename))
- return NOTMUCH_STATUS_OUT_OF_MEMORY;
-
- status = _notmuch_message_add_filename (message, new_filename);
- if (status)
- return status;
-
- status = _notmuch_database_filename_to_direntry (local, message->notmuch,
- old_filename, &direntry);
- if (status)
- return status;
-
- private_status = _notmuch_message_remove_term (message, "file-direntry", direntry);
- status = COERCE_STATUS (private_status,
- "Unexpected error from _notmuch_message_remove_term");
-
- talloc_free (local);
-
- return status;
-}
-