We've had _notmuch_message_database() internally for a while, and it's
useful. It turns out to be useful on the other side of the library
interface as well (i'll use it later in this series for "notmuch
show"), so we expose it publicly now.
---
lib/index.cc| 10 +-
lib/message-property.cc | 4 ++--
lib/message.cc | 14 +++---
lib/notmuch-private.h | 2 --
lib/notmuch.h | 8
5 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc
index 0ad683fa..22ca9ec1 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -385,7 +385,7 @@ _index_mime_part (notmuch_message_t *message,
const char *charset;
if (! part) {
- _notmuch_database_log (_notmuch_message_database (message),
+ _notmuch_database_log (notmuch_message_get_database (message),
"Warning: Not indexing empty mime part.\n");
return;
}
@@ -411,7 +411,7 @@ _index_mime_part (notmuch_message_t *message,
g_mime_multipart_get_part (multipart,
i));
continue;
} else if (i != GMIME_MULTIPART_SIGNED_CONTENT) {
- _notmuch_database_log (_notmuch_message_database (message),
+ _notmuch_database_log (notmuch_message_get_database
(message),
"Warning: Unexpected extra parts of
multipart/signed. Indexing anyway.\n");
}
}
@@ -424,7 +424,7 @@ _index_mime_part (notmuch_message_t *message,
GMIME_MULTIPART_ENCRYPTED
(part));
} else {
if (i != GMIME_MULTIPART_ENCRYPTED_VERSION) {
- _notmuch_database_log (_notmuch_message_database
(message),
+ _notmuch_database_log (notmuch_message_get_database
(message),
"Warning: Unexpected extra parts
of multipart/encrypted.\n");
}
}
@@ -447,7 +447,7 @@ _index_mime_part (notmuch_message_t *message,
}
if (! (GMIME_IS_PART (part))) {
- _notmuch_database_log (_notmuch_message_database (message),
+ _notmuch_database_log (notmuch_message_get_database (message),
"Warning: Not indexing unknown mime part: %s.\n",
g_type_name (G_OBJECT_TYPE (part)));
return;
@@ -528,7 +528,7 @@ _index_encrypted_mime_part (notmuch_message_t *message,
if (!indexopts || (notmuch_indexopts_get_decrypt_policy (indexopts) ==
NOTMUCH_DECRYPT_FALSE))
return;
-notmuch = _notmuch_message_database (message);
+notmuch = notmuch_message_get_database (message);
GMimeCryptoContext* crypto_ctx = NULL;
#if (GMIME_MAJOR_VERSION < 3)
diff --git a/lib/message-property.cc b/lib/message-property.cc
index 6525fb24..210a15cc 100644
--- a/lib/message-property.cc
+++ b/lib/message-property.cc
@@ -44,7 +44,7 @@ _notmuch_message_modify_property (notmuch_message_t *message,
const char *key, c
notmuch_status_t status;
char *term = NULL;
-status = _notmuch_database_ensure_writable (_notmuch_message_database
(message));
+status = _notmuch_database_ensure_writable (notmuch_message_get_database
(message));
if (status)
return status;
@@ -92,7 +92,7 @@ _notmuch_message_remove_all_properties (notmuch_message_t
*message, const char *
notmuch_status_t status;
const char * term_prefix;
-status = _notmuch_database_ensure_writable (_notmuch_message_database
(message));
+status = _notmuch_database_ensure_writable (notmuch_message_get_database
(message));
if (status)
return status;
diff --git a/lib/message.cc b/lib/message.cc
index b2067076..a7e8c3ca 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -268,7 +268,7 @@ _notmuch_message_create_for_message_id (notmuch_database_t
*notmuch,
doc_id = _notmuch_database_generate_doc_id (notmuch);
} catch (const Xapian::Error ) {
- _notmuch_database_log(_notmuch_message_database (message), "A Xapian
exception occurred creating message: %s\n",
+ _notmuch_database_log(notmuch_message_get_database (message), "A Xapian
exception occurred creating message: %s\n",
error.get_msg().c_str());
notmuch->exception_reported = true;
*status_ret = NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION;
@@ -512,7 +512,7 @@ _notmuch_message_ensure_message_file (notmuch_message_t
*message)
return;
message->message_file = _notmuch_message_file_open_ctx (
- _notmuch_message_database (message), message, filename);
+ notmuch_message_get_database (message), message, filename);
}
const char *
@@ -542,7 +542,7 @@ notmuch_message_get_header (notmuch_message_t *message,
const char *header)
return talloc_strdup (message, value.c_str ());
} catch