if (unlikely (message == NULL))
return NULL;
- const char *prefix = notmuch_database_get_path (notmuch);
+ const char *prefix = notmuch_config_get (notmuch, NOTMUCH_CONFIG_MAIL_ROOT);
+
if (prefix == NULL)
goto FAIL;
if (*filename == '/') {
- if (strncmp (filename, prefix, strlen(prefix)) != 0) {
+ if (strncmp (filename, prefix, strlen (prefix)) != 0) {
_notmuch_database_log (notmuch, "Error opening %s: path outside mail root\n",
filename);
errno = 0;
}
message->filename = talloc_strdup (message, filename);
} else {
- message->filename = talloc_asprintf(message, "%s/%s", prefix, filename);
+ message->filename = talloc_asprintf (message, "%s/%s", prefix, filename);
}
if (message->filename == NULL)
{
GMimeParser *parser;
notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
- static int initialized = 0;
bool is_mbox;
if (message->message)
is_mbox = _is_mbox (message->stream);
- if (! initialized) {
- g_mime_init ();
- initialized = 1;
- }
+ _notmuch_init ();
message->headers = g_hash_table_new_full (strcase_hash, strcase_equal,
free, g_free);