Skip to content

Commit

Permalink
fix cs
Browse files Browse the repository at this point in the history
  • Loading branch information
YWatchman committed Jan 11, 2023
1 parent 63b1bd0 commit 65492be
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
36 changes: 18 additions & 18 deletions src/lib-storage/mailbox-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ int mailbox_list_create(const char *driver, struct mail_namespace *ns,
}

if ((class->props & MAILBOX_LIST_PROP_NO_MAILDIR_NAME) != 0 &&
*set->maildir_name != '\0') {
*set->maildir_name != '\0') {
*error_r = "maildir_name not supported by this driver";
return -1;
}
Expand Down Expand Up @@ -334,7 +334,7 @@ mailbox_list_settings_parse_full(struct mail_user *user, const char *data,
dest = &set_r->inbox_path;
else if (strcmp(key, "INDEX") == 0)
dest = &set_r->index_dir;
else if (strcmp(key, "FTS_INDEX") == 0)
else if (strcmp(key, "FTS_INDEX") == 0)
dest = &set_r->fts_index_dir;
else if (strcmp(key, "INDEXPVT") == 0)
dest = &set_r->index_pvt_dir;
Expand Down Expand Up @@ -1488,22 +1488,22 @@ bool mailbox_list_set_get_root_path(const struct mailbox_list_settings *set,
path = set->root_dir;
}
break;
case MAILBOX_LIST_PATH_TYPE_FTS_INDEX:
if (set->fts_index_dir != NULL) {
if (set->fts_index_dir[0] == '\0') {
/* in-memory indexes */
return 0;
}
path = set->fts_index_dir;

/* Preserve the old behavior of using the index directory if
* fts_index_dir is not set. */
} else if (set->index_dir != NULL) {
path = set->index_dir;
} else {
path = set->root_dir;
}
break;
case MAILBOX_LIST_PATH_TYPE_FTS_INDEX:
if (set->fts_index_dir != NULL) {
if (set->fts_index_dir[0] == '\0') {
/* in-memory indexes */
return 0;
}
path = set->fts_index_dir;

/* Preserve the old behavior of using the index directory if
* fts_index_dir is not set. */
} else if (set->index_dir != NULL) {
path = set->index_dir;
} else {
path = set->root_dir;
}
break;
case MAILBOX_LIST_PATH_TYPE_INDEX_PRIVATE:
path = set->index_pvt_dir;
break;
Expand Down
4 changes: 2 additions & 2 deletions src/lib-storage/mailbox-list.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ enum mailbox_list_path_type {
/* Return mailbox list index directory (usually same as
MAILBOX_LIST_PATH_TYPE_INDEX) */
MAILBOX_LIST_PATH_TYPE_LIST_INDEX,
/* Return mailbox fts index directory path */
MAILBOX_LIST_PATH_TYPE_FTS_INDEX,
/* Return mailbox fts index directory path */
MAILBOX_LIST_PATH_TYPE_FTS_INDEX,

MAILBOX_LIST_PATH_TYPE_COUNT
};
Expand Down
20 changes: 10 additions & 10 deletions src/plugins/fts-flatcurve/fts-backend-flatcurve.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,20 @@ fts_backend_flatcurve_set_mailbox(struct flatcurve_fts_backend *backend,
}

if (mailbox_open(box) < 0
|| (mailbox_path_exists(box, MAILBOX_LIST_PATH_TYPE_INDEX) == 0 &&
mailbox_path_exists(box, MAILBOX_LIST_PATH_TYPE_FTS_INDEX) == 0)
) {
|| (mailbox_path_exists(box, MAILBOX_LIST_PATH_TYPE_INDEX) == 0 &&
mailbox_path_exists(box, MAILBOX_LIST_PATH_TYPE_FTS_INDEX) == 0)
) {
*error_r = t_strdup_printf("Could not open mailbox: %s: %s",
box->vname,
mailbox_get_last_internal_error(box, NULL));
box->vname,
mailbox_get_last_internal_error(box, NULL));
return -1;
}

if (mailbox_path_exists(box, MAILBOX_LIST_PATH_TYPE_FTS_INDEX)) {
mailbox_get_path_to(box, MAILBOX_LIST_PATH_TYPE_FTS_INDEX, &path);
} else {
mailbox_get_path_to(box, MAILBOX_LIST_PATH_TYPE_INDEX, &path);
}
if (mailbox_path_exists(box, MAILBOX_LIST_PATH_TYPE_FTS_INDEX)) {
mailbox_get_path_to(box, MAILBOX_LIST_PATH_TYPE_FTS_INDEX, &path);
} else {
mailbox_get_path_to(box, MAILBOX_LIST_PATH_TYPE_INDEX, &path);
}

str_append(backend->boxname, box->vname);
str_printfa(backend->db_path, "%s/%s/", path, FTS_FLATCURVE_LABEL);
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/fts/fts-storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,8 @@ fts_mailbox_list_created(struct mailbox_list *list)
return;
}

/* TODO: Create config item for MAILBOX_LIST_PATH_TYPE... FTS_INDEX||=INDEX */
bool has_fts_index_path = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_FTS_INDEX, &path);
/* TODO: Create config item for MAILBOX_LIST_PATH_TYPE... FTS_INDEX||=INDEX */
bool has_fts_index_path = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_FTS_INDEX, &path);
if (!mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX, &path) && !has_fts_index_path) {
e_debug(list->ns->user->event,
"fts: Indexes disabled for namespace '%s'",
Expand Down

0 comments on commit 65492be

Please sign in to comment.