Пример #1
0
/* Remove a message from the given notmuch database.
 *
 * Note that only this particular filename association is removed from
 * the database. If the same message (as determined by the message ID)
 * is still available via other filenames, then the message will
 * persist in the database for those filenames. When the last filename
 * is removed for a particular message, the database content for that
 * message will be entirely removed.
 *
 * Return value:
 *
 * NOTMUCH_STATUS_SUCCESS: The last filename was removed and the
 *	message was removed from the database.
 *
 * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred,
 *	message not removed.
 *
 * NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: This filename was removed but
 *	the message persists in the database with at least one other
 *	filename.
 *
 * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only
 *	mode so no message can be removed.
 */
func (self *Database) RemoveMessage(fname string) Status {

	var c_fname *C.char = C.CString(fname)
	defer C.free(unsafe.Pointer(c_fname))

	if c_fname == nil {
		return STATUS_OUT_OF_MEMORY
	}

	st := C.notmuch_database_remove_message(self.db, c_fname)
	return Status(st)
}
Пример #2
0
Файл: db.go Проект: gmuch/gmuch
// RemoveMessage remove a message filename from the current database. If the
// message has no more filenames, remove the message.
func (db *DB) RemoveMessage(filename string) error {
	cfilename := C.CString(filename)
	defer C.free(unsafe.Pointer(cfilename))

	return statusErr(C.notmuch_database_remove_message(db.toC(), cfilename))
}