notmuch_database_t *notmuch;
Xapian::docid doc_id;
char *message_id;
+ char *filename;
Xapian::Document doc;
};
message->notmuch = notmuch;
message->doc_id = doc_id;
message->message_id = NULL; /* lazily created */
+ message->filename = NULL; /* lazily created */
new (&message->doc) Xapian::Document;
talloc_set_destructor (message, _notmuch_message_destructor);
return message->message_id;
}
+const char *
+notmuch_message_get_filename (notmuch_message_t *message)
+{
+ std::string filename_str;
+
+ if (message->filename)
+ return message->filename;
+
+ filename_str = message->doc.get_data ();
+ message->filename = talloc_strdup (message, filename_str.c_str ());
+
+ return message->filename;
+}
+
/* We end up having to call the destructors explicitly because we had
* to use "placement new" in order to initialize C++ objects within a
* block that we allocated with talloc. So C++ is making talloc
const char *
notmuch_message_get_message_id (notmuch_message_t *message);
+/* Get this filename for the email corresponding to 'message'.
+ *
+ * The returned filename is relative to the base of the database from
+ * which 'message' was obtained. See notmuch_database_get_path() .*/
+const char *
+notmuch_message_get_filename (notmuch_message_t *message);
+
/* Get the tags for 'message', returning a notmuch_tags_t object which
* can be used to iterate over all tags.
*