dovecot-2.2: imapc: Index dirs were being wrongly deleted when i...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jun 6 06:55:56 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/0a88c358cf82
changeset: 16461:0a88c358cf82
user: Timo Sirainen <tss at iki.fi>
date: Thu Jun 06 06:55:34 2013 +0300
description:
imapc: Index dirs were being wrongly deleted when imapc_list_prefix was set.
diffstat:
src/lib-storage/index/imapc/imapc-list.c | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)
diffs (51 lines):
diff -r 452cecc7e708 -r 0a88c358cf82 src/lib-storage/index/imapc/imapc-list.c
--- a/src/lib-storage/index/imapc/imapc-list.c Thu Jun 06 06:32:58 2013 +0300
+++ b/src/lib-storage/index/imapc/imapc-list.c Thu Jun 06 06:55:34 2013 +0300
@@ -361,7 +361,9 @@
struct mailbox_list *fs_list = imapc_list_get_fs(list);
struct mailbox_list_iterate_context *iter;
const struct mailbox_info *info;
- const char *fs_name;
+ const char *imapc_list_prefix = list->storage->set->imapc_list_prefix;
+ unsigned int imapc_list_prefix_len = strlen(imapc_list_prefix);
+ const char *fs_name, *vname;
if (fs_list == NULL)
return;
@@ -370,13 +372,33 @@
MAILBOX_LIST_ITER_RAW_LIST |
MAILBOX_LIST_ITER_NO_AUTO_BOXES |
MAILBOX_LIST_ITER_RETURN_NO_FLAGS);
- while ((info = mailbox_list_iter_next(iter)) != NULL) {
- if (mailbox_tree_lookup(list->mailboxes, info->vname) == NULL) {
+ while ((info = mailbox_list_iter_next(iter)) != NULL) T_BEGIN {
+ vname = info->vname;
+ if (imapc_list_prefix_len > 0) {
+ /* skip over the namespace prefix */
+ i_assert(strncmp(vname, fs_list->ns->prefix,
+ fs_list->ns->prefix_len) == 0);
+ vname += fs_list->ns->prefix_len;
+ /* skip over the imapc list prefix */
+ i_assert(strncmp(vname, imapc_list_prefix,
+ imapc_list_prefix_len) == 0);
+ vname += imapc_list_prefix_len;
+ if (vname[0] != '\0') {
+ i_assert(vname[0] == mail_namespace_get_sep(fs_list->ns));
+ vname++;
+ }
+ /* put back the namespace prefix */
+ if (fs_list->ns->prefix_len > 0) {
+ vname = t_strconcat(fs_list->ns->prefix,
+ vname, NULL);
+ }
+ }
+ if (mailbox_tree_lookup(list->mailboxes, vname) == NULL) {
fs_name = mailbox_list_get_storage_name(fs_list,
info->vname);
(void)fs_list->v.delete_mailbox(fs_list, fs_name);
}
- }
+ } T_END;
(void)mailbox_list_iter_deinit(&iter);
}
More information about the dovecot-cvs
mailing list