X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fmessage.cc;h=f0e905b70a339cc9c643710f313aa978c768e141;hb=184625ac9b4a336bafc94bd7409ae176917d5050;hp=ea9c8bd96afb1b34ccb8ebb329c5f93ebcaa344b;hpb=f93b7218c3e2d11c5b3cdd4c367a42ca7a7ede77;p=notmuch diff --git a/lib/message.cc b/lib/message.cc index ea9c8bd9..f0e905b7 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -192,7 +192,7 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch, db = static_cast (notmuch->xapian_db); try { - doc.add_term (term); + doc.add_term (term, 0); talloc_free (term); doc.add_value (NOTMUCH_VALUE_MESSAGE_ID, message_id); @@ -416,6 +416,18 @@ _notmuch_message_add_filename (notmuch_message_t *message, return NOTMUCH_STATUS_SUCCESS; } +char * +_notmuch_message_talloc_copy_data (notmuch_message_t *message) +{ + return talloc_strdup (message, message->doc.get_data ().c_str ()); +} + +void +_notmuch_message_clear_data (notmuch_message_t *message) +{ + message->doc.set_data (""); +} + const char * notmuch_message_get_filename (notmuch_message_t *message) { @@ -441,7 +453,10 @@ notmuch_message_get_filename (notmuch_message_t *message) { /* A message document created by an old version of notmuch * (prior to rename support) will have the filename in the - * data of the document rather than as a file-direntry term. */ + * data of the document rather than as a file-direntry term. + * + * It would be nice to do the upgrade of the document directly + * here, but the database is likely open in read-only mode. */ const char *data; data = message->doc.get_data ().c_str (); @@ -631,7 +646,7 @@ _notmuch_message_add_term (notmuch_message_t *message, if (strlen (term) > NOTMUCH_TERM_MAX) return NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG; - message->doc.add_term (term); + message->doc.add_term (term, 0); talloc_free (term);