X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fmessage.cc;h=5bc7aff1386a4a7e09a461f98f7e37f86e5a3f58;hb=8cca886b10c5ec44f3214701c0c1e3c896d53d5c;hp=bacb4d46a0c1aa336a91e3b76b65097b1b1884c5;hpb=3d978a0d61df072de7e4fd52120f3448cf8e9df6;p=notmuch diff --git a/lib/message.cc b/lib/message.cc index bacb4d46..5bc7aff1 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -252,7 +252,7 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch, doc_id = _notmuch_database_generate_doc_id (notmuch); } catch (const Xapian::Error &error) { - fprintf (stderr, "A Xapian exception occurred creating message: %s\n", + _notmuch_database_log(_notmuch_message_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; @@ -283,7 +283,7 @@ _notmuch_message_get_term (notmuch_message_t *message, if (i == end) return NULL; - std::string term = *i; + const std::string &term = *i; if (strncmp (term.c_str(), prefix, prefix_len)) return NULL; @@ -437,7 +437,8 @@ _notmuch_message_ensure_message_file (notmuch_message_t *message) if (unlikely (filename == NULL)) return; - message->message_file = _notmuch_message_file_open_ctx (message, filename); + message->message_file = _notmuch_message_file_open_ctx ( + _notmuch_message_database (message), message, filename); } const char * @@ -467,7 +468,7 @@ notmuch_message_get_header (notmuch_message_t *message, const char *header) return talloc_strdup (message, value.c_str ()); } catch (Xapian::Error &error) { - fprintf (stderr, "A Xapian exception occurred when reading header: %s\n", + _notmuch_database_log(_notmuch_message_database (message), "A Xapian exception occurred when reading header: %s\n", error.get_msg().c_str()); message->notmuch->exception_reported = TRUE; return NULL; @@ -641,7 +642,7 @@ _notmuch_message_add_directory_terms (void *ctx, notmuch_message_t *message) unsigned int directory_id; const char *direntry, *directory; char *colon; - const std::string term = *i; + const std::string &term = *i; /* Terminate loop at first term without desired prefix. */ if (strncmp (term.c_str (), direntry_prefix, direntry_prefix_len)) @@ -921,7 +922,7 @@ notmuch_message_get_date (notmuch_message_t *message) try { value = message->doc.get_value (NOTMUCH_VALUE_TIMESTAMP); } catch (Xapian::Error &error) { - fprintf (stderr, "A Xapian exception occurred when reading date: %s\n", + _notmuch_database_log(_notmuch_message_database (message), "A Xapian exception occurred when reading date: %s\n", error.get_msg().c_str()); message->notmuch->exception_reported = TRUE; return 0; @@ -1626,3 +1627,9 @@ notmuch_message_destroy (notmuch_message_t *message) { talloc_free (message); } + +notmuch_database_t * +_notmuch_message_database (notmuch_message_t *message) +{ + return message->notmuch; +}