dsync_mailbox_tree_iter_init(brain->local_mailbox_tree);
}
-static const char *const *
-dsync_brain_mailbox_to_parts(struct dsync_brain *brain, const char *name)
-{
- char sep[] = { brain->hierarchy_sep, '\0' };
- char **parts = p_strsplit(unsafe_data_stack_pool, name, sep);
- for (unsigned int i = 0; parts[i] != NULL; i++) {
- mailbox_list_name_unescape((const char **)&parts[i],
- brain->escape_char);
- }
- return (const char *const *)parts;
-}
-
void dsync_brain_send_mailbox_tree(struct dsync_brain *brain)
{
struct dsync_mailbox_node *node;
dsync_mailbox_node_to_string(node));
}
- parts = dsync_brain_mailbox_to_parts(brain, full_name);
+ parts = dsync_mailbox_name_to_parts(full_name, brain->hierarchy_sep,
+ brain->escape_char);
ret = dsync_ibc_send_mailbox_tree_node(brain->ibc,
parts, node);
} T_END;
}
i_unreached();
}
+
+const char *const *
+dsync_mailbox_name_to_parts(const char *name, char hierarchy_sep,
+ char escape_char)
+{
+ const char sep[] = { hierarchy_sep, '\0' };
+ char **parts = p_strsplit(unsafe_data_stack_pool, name, sep);
+ if (escape_char != '\0') {
+ for (unsigned int i = 0; parts[i] != NULL; i++) {
+ mailbox_list_name_unescape((const char **)&parts[i],
+ escape_char);
+ }
+ }
+ return (const char *const *)parts;
+}
void dsync_mailbox_node_copy_data(struct dsync_mailbox_node *dest,
const struct dsync_mailbox_node *src);
+/* Split mailbox name into its hierarchical parts. The mailbox name is
+ unescaped if the escape_char is not '\0'. */
+const char *const *
+dsync_mailbox_name_to_parts(const char *name, char hierarchy_sep,
+ char escape_char);
/* Add nodes to tree from the given namespace. If box_name or box_guid is
non-NULL, add only that mailbox to the tree. */
int dsync_mailbox_tree_fill(struct dsync_mailbox_tree *tree,