Persisting this status will allow us to use the information in other
compilation units, in particular when setting configuration defaults.
Xapian::QueryParser::FLAG_PURE_NOT)
/*
Xapian::QueryParser::FLAG_PURE_NOT)
/*
- * Which parameters were explicit when the database was opened */
+ * explicit and implied parameters to open */
typedef enum {
NOTMUCH_PARAM_NONE = 0,
typedef enum {
NOTMUCH_PARAM_NONE = 0,
+ /* database passed explicitely */
NOTMUCH_PARAM_DATABASE = 1 << 0,
NOTMUCH_PARAM_DATABASE = 1 << 0,
+ /* config file passed explicitely */
NOTMUCH_PARAM_CONFIG = 1 << 1,
NOTMUCH_PARAM_CONFIG = 1 << 1,
+ /* profile name passed explicitely */
NOTMUCH_PARAM_PROFILE = 1 << 2,
NOTMUCH_PARAM_PROFILE = 1 << 2,
+ /* split (e.g. XDG) configuration */
+ NOTMUCH_PARAM_SPLIT = 1 << 3,
} notmuch_open_param_t;
/*
} notmuch_open_param_t;
/*
const char *profile,
GKeyFile *key_file,
const char **database_path,
const char *profile,
GKeyFile *key_file,
const char **database_path,
char **message)
{
if (! *database_path) {
char **message)
{
if (! *database_path) {
if (status) {
*database_path = NULL;
} else {
if (status) {
*database_path = NULL;
} else {
+ notmuch->params |= NOTMUCH_PARAM_SPLIT;
notmuch_database_t *notmuch = NULL;
char *message = NULL;
GKeyFile *key_file = NULL;
notmuch_database_t *notmuch = NULL;
char *message = NULL;
GKeyFile *key_file = NULL;
}
if ((status = _choose_database_path (notmuch, profile, key_file,
}
if ((status = _choose_database_path (notmuch, profile, key_file,
- &database_path, &split,
char *message = NULL;
GKeyFile *key_file = NULL;
int err;
char *message = NULL;
GKeyFile *key_file = NULL;
int err;
}
if ((status = _choose_database_path (notmuch, profile, key_file,
}
if ((status = _choose_database_path (notmuch, profile, key_file,
- &database_path, &split, &message)))
+ &database_path, &message)))
goto DONE;
status = _db_dir_exists (database_path, &message);
goto DONE;
status = _db_dir_exists (database_path, &message);
_set_database_path (notmuch, database_path);
_set_database_path (notmuch, database_path);
- if (key_file && ! split) {
+ if (key_file && ! (notmuch->params & NOTMUCH_PARAM_SPLIT)) {
char *mail_root = notmuch_canonicalize_file_name (
g_key_file_get_string (key_file, "database", "mail_root", NULL));
char *db_path = notmuch_canonicalize_file_name (database_path);
char *mail_root = notmuch_canonicalize_file_name (
g_key_file_get_string (key_file, "database", "mail_root", NULL));
char *db_path = notmuch_canonicalize_file_name (database_path);
- split = (mail_root && (0 != strcmp (mail_root, db_path)));
+ if (mail_root && (0 != strcmp (mail_root, db_path)))
+ notmuch->params |= NOTMUCH_PARAM_SPLIT;
free (mail_root);
free (db_path);
}
free (mail_root);
free (db_path);
}
+ if (notmuch->params & NOTMUCH_PARAM_SPLIT) {
notmuch_path = database_path;
} else {
if (! (notmuch_path = talloc_asprintf (notmuch, "%s/%s", database_path, ".notmuch"))) {
notmuch_path = database_path;
} else {
if (! (notmuch_path = talloc_asprintf (notmuch, "%s/%s", database_path, ".notmuch"))) {
notmuch_database_t *notmuch = NULL;
char *message = NULL;
GKeyFile *key_file = NULL;
notmuch_database_t *notmuch = NULL;
char *message = NULL;
GKeyFile *key_file = NULL;
}
status = _choose_database_path (notmuch, profile, key_file,
}
status = _choose_database_path (notmuch, profile, key_file,
- &database_path, &split, &message);
+ &database_path, &message);
switch (status) {
case NOTMUCH_STATUS_NO_DATABASE:
case NOTMUCH_STATUS_SUCCESS:
switch (status) {
case NOTMUCH_STATUS_NO_DATABASE:
case NOTMUCH_STATUS_SUCCESS: