mailbox-list-maildir.c revision 441f0e0d84082eb498e620327ebf4de509052d15
5f5870385cff47efd2f58e7892f251cf13761528Timo Sirainen/* Copyright (c) 2006-2015 Dovecot authors, see the included COPYING file */
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainenextern struct mailbox_list maildir_mailbox_list;
134582c78f038b4d9b9fde127399aefa50935a53Timo Sirainenextern struct mailbox_list imapdir_mailbox_list;
134582c78f038b4d9b9fde127399aefa50935a53Timo Sirainenstatic struct mailbox_list *maildir_list_alloc(void)
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainen pool = pool_alloconly_create("maildir++ list", 2048);
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainen list = p_new(pool, struct maildir_mailbox_list, 1);
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainen list->global_temp_prefix = MAILDIR_GLOBAL_TEMP_PREFIX;
134582c78f038b4d9b9fde127399aefa50935a53Timo Sirainen list->temp_prefix = p_strconcat(pool, list->global_temp_prefix,
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainenstatic struct mailbox_list *imapdir_list_alloc(void)
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainen pool = pool_alloconly_create("imapdir list", 1024);
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainen list = p_new(pool, struct maildir_mailbox_list, 1);
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainen list->global_temp_prefix = IMAPDIR_GLOBAL_TEMP_PREFIX;
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainen list->temp_prefix = p_strconcat(pool, list->global_temp_prefix,
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainenstatic void maildir_list_deinit(struct mailbox_list *_list)
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainenstatic const char *
4f77d2f0f0743ad09d2a34e18be8eacf8014b7e0Pascal Volkmaildir_list_get_dirname_path(struct mailbox_list *list, const char *dir,
4f77d2f0f0743ad09d2a34e18be8eacf8014b7e0Pascal Volk const char *name)
5fbccc935e3f7b916aa7c6e302a212821072e83aTimo Sirainen else if (list->name == imapdir_mailbox_list.name)
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainenstatic const char *
c664d0da658c8d3200d88ea3c4cd580afd33fa73Timo Sirainenmaildir_list_get_absolute_path(struct mailbox_list *list, const char *name)
bde78a7bf5f9000f1ae4dc7ce6cabd012e1f8b79Pascal Volk const char *p;
134582c78f038b4d9b9fde127399aefa50935a53Timo Sirainen if (!mailbox_list_try_get_absolute_path(list, &name)) {
134582c78f038b4d9b9fde127399aefa50935a53Timo Sirainen /* fallback to using as ~name */
134582c78f038b4d9b9fde127399aefa50935a53Timo Sirainen return maildir_list_get_dirname_path(list, t_strdup_until(name, p),
4f77d2f0f0743ad09d2a34e18be8eacf8014b7e0Pascal Volkstatic char maildir_list_get_hierarchy_sep(struct mailbox_list *_list)
134582c78f038b4d9b9fde127399aefa50935a53Timo Sirainenmaildir_list_get_path(struct mailbox_list *_list, const char *name,
134582c78f038b4d9b9fde127399aefa50935a53Timo Sirainen enum mailbox_list_path_type type, const char **path_r)
134582c78f038b4d9b9fde127399aefa50935a53Timo Sirainen /* return root directories */
134582c78f038b4d9b9fde127399aefa50935a53Timo Sirainen return mailbox_list_set_get_root_path(&_list->set, type,
switch (type) {
const char *path;
const char *root_dir;
int ret = 0;
if (ret < 0)
if (ret == 0) {
&path) <= 0)
i_unreached();
const char *path;
int ret;
&path);
if (ret < 0)
return ret;
const char *path;
&path) <= 0)
i_unreached();
char old_ns_sep;
int ret;
ret = 0;
const char *name;
for (i = 0; i < count; i++) {
&oldpath) <= 0 ||
&newpath) <= 0)
i_unreached();
return ret;
int ret;
bool found;
i_unreached();
oldname));
T_BEGIN {
} T_END;
if (ret < 0)
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,