This clarifies that it's only used in storage_names.
so we need to use the remote IMAP separator. */
list_name = mailbox_list_escape_name_params(imapc_name, "", list->root_sep,
mailbox_list_get_hierarchy_sep(&list->list),
- list->list.set.escape_char, "");
+ list->list.set.storage_name_escape_char, "");
/* list_name is now valid, so we can convert it to vname */
return mailbox_list_get_vname(&list->list, list_name);
}
{
return mailbox_list_unescape_name_params(name, "", list->root_sep,
mailbox_list_get_hierarchy_sep(&list->list),
- list->list.set.escape_char);
+ list->list.set.storage_name_escape_char);
}
static struct mailbox_node *
mailbox_list_settings_init_defaults(&list_set);
list_set.layout = MAILBOX_LIST_NAME_MAILDIRPLUSPLUS;
list_set.root_dir = dir;
- list_set.escape_char = IMAPC_LIST_ESCAPE_CHAR;
+ list_set.storage_name_escape_char =
+ IMAPC_LIST_STORAGE_NAME_ESCAPE_CHAR;
list_set.broken_char = IMAPC_LIST_BROKEN_CHAR;
if (mailbox_list_create(list_set.layout, list->list.ns,
{
if (set->layout == NULL)
set->layout = MAILBOX_LIST_NAME_IMAPC;
- set->escape_char = IMAPC_LIST_ESCAPE_CHAR;
+ set->storage_name_escape_char = IMAPC_LIST_STORAGE_NAME_ESCAPE_CHAR;
}
static struct mailbox *
#include "imapc-client.h"
#define IMAPC_STORAGE_NAME "imapc"
-#define IMAPC_LIST_ESCAPE_CHAR '%'
+#define IMAPC_LIST_STORAGE_NAME_ESCAPE_CHAR '%'
#define IMAPC_LIST_BROKEN_CHAR '~'
struct imap_arg;
/* If namespace { separator } differs from the mailbox_list separator,
the list separator can't actually be used in the mailbox name
- unless it's escaped with escape_char. For example if namespace
- separator is '/' and LAYOUT=Maildir++ has '.' as the separator,
- there's no way to use '.' in the mailbox name (without escaping)
- because it would end up becoming a hierarchy separator. */
- if (ns_sep != list_sep && box->list->set.escape_char == '\0' &&
+ unless it's escaped with storage_name_escape_char. For example if
+ namespace separator is '/' and LAYOUT=Maildir++ has '.' as the
+ separator, there's no way to use '.' in the mailbox name (without
+ escaping) because it would end up becoming a hierarchy separator. */
+ if (ns_sep != list_sep &&
+ box->list->set.storage_name_escape_char == '\0' &&
strchr(vname, list_sep) != NULL) {
mail_storage_set_error(box->storage, MAIL_ERROR_PARAMS, t_strdup_printf(
"Character not allowed in mailbox name: '%c'", list_sep));
list->set.mailbox_dir_name =
p_strconcat(list->pool, set->mailbox_dir_name, "/", NULL);
}
- list->set.escape_char = set->escape_char;
+ list->set.storage_name_escape_char = set->storage_name_escape_char;
list->set.broken_char = set->broken_char;
list->set.utf8 = set->utf8;
return mailbox_list_escape_name_params(vname, list->ns->prefix,
mail_namespace_get_sep(list->ns),
mailbox_list_get_hierarchy_sep(list),
- list->set.escape_char, list->set.maildir_name);
+ list->set.storage_name_escape_char,
+ list->set.maildir_name);
}
static int
if (strcasecmp(storage_name, "INBOX") == 0 &&
(ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0)
storage_name = "INBOX";
- else if (list->set.escape_char != '\0')
+ else if (list->set.storage_name_escape_char != '\0')
storage_name = mailbox_list_escape_name(list, vname);
if (prefix_len > 0 && (strcmp(storage_name, "INBOX") != 0 ||
storage_name = "INBOX";
}
- if (list_sep != ns_sep && list->set.escape_char == '\0') {
+ if (list_sep != ns_sep && list->set.storage_name_escape_char == '\0') {
if (ns->type == MAIL_NAMESPACE_TYPE_SHARED &&
(ns->flags & NAMESPACE_FLAG_AUTOCREATED) == 0) {
/* shared namespace root. the backend storage's
return mailbox_list_unescape_name_params(src, list->ns->prefix,
mail_namespace_get_sep(list->ns),
mailbox_list_get_hierarchy_sep(list),
- list->set.escape_char);
+ list->set.storage_name_escape_char);
}
static void
}
prefix_len = strlen(list->ns->prefix);
- if (list->set.escape_char != '\0') {
+ if (list->set.storage_name_escape_char != '\0') {
vname = mailbox_list_unescape_name(list, vname);
return prefix_len == 0 ? vname :
t_strconcat(list->ns->prefix, vname, NULL);
const char *mailbox_dir_name;
/* Encode "bad" characters in mailbox names as <escape_char><hex> */
- char escape_char;
+ char storage_name_escape_char;
/* If mailbox name can't be changed reversibly to UTF-8 and back,
encode the problematic parts using <broken_char><hex> in the
user-visible UTF-8 name. The broken_char itself also has to be
{
const char *env;
- if (list->set.escape_char == '\0') {
+ if (list->set.storage_name_escape_char == '\0') {
env = mail_user_plugin_getenv(list->ns->user, "listescape_char");
- list->set.escape_char = env != NULL && *env != '\0' ?
+ list->set.storage_name_escape_char =
+ env != NULL && *env != '\0' ?
env[0] : DEFAULT_ESCAPE_CHAR;
}
}