Lines Matching refs:node
63 struct dsync_mailbox_node *node = &tree->root;
69 for (; *path != NULL && node != NULL; path++)
70 node = dsync_mailbox_node_find(node->first_child, *path);
72 return node;
75 void dsync_mailbox_tree_node_attach(struct dsync_mailbox_node *node,
78 node->parent = parent;
79 node->next = parent->first_child;
80 parent->first_child = node;
83 void dsync_mailbox_tree_node_detach(struct dsync_mailbox_node *node)
87 for (p = &node->parent->first_child;; p = &(*p)->next) {
88 if (*p == node) {
89 *p = node->next;
93 node->parent = NULL;
99 struct dsync_mailbox_node *parent = NULL, *node = &tree->root;
109 parent = node;
110 node = dsync_mailbox_node_find(node->first_child, *path);
111 if (node == NULL)
116 node = p_new(tree->pool, struct dsync_mailbox_node, 1);
117 node->name = p_strdup(tree->pool, *path);
118 node->ns = parent->ns;
119 dsync_mailbox_tree_node_attach(node, parent);
120 parent = node;
123 return node;
128 const struct dsync_mailbox_node *node, string_t *str)
130 if (node->parent != &tree->root)
131 node_get_full_name_recurse(tree, node->parent, str);
133 str_append(str, node->name);
138 const struct dsync_mailbox_node *node)
141 dsync_mailbox_node_append_full_name(str, tree, node);
147 const struct dsync_mailbox_node *node)
149 i_assert(node->parent != NULL);
151 node_get_full_name_recurse(tree, node, str);
183 static size_t node_get_full_name_length(struct dsync_mailbox_node *node)
185 if (node->parent->parent == NULL)
186 return strlen(node->name);
188 return strlen(node->name) + 1 +
189 node_get_full_name_length(node->parent);
236 struct dsync_mailbox_node *node;
246 while (dsync_mailbox_tree_iter_next(iter, &name, &node)) {
250 hash_table_insert(tree->name128_hash, guid_p, node);
275 struct dsync_mailbox_node *node;
286 while (dsync_mailbox_tree_iter_next(iter, &name, &node)) {
294 hash_table_insert(tree->name128_remotesep_hash, guid_p, node);
300 struct dsync_mailbox_node *node,
304 uint8_t *guid = node->mailbox_guid;
306 if (guid_128_is_empty(node->mailbox_guid))
311 hash_table_insert(tree->guid_hash, guid, node);
312 else if (old_node != node)
322 struct dsync_mailbox_node *node, *old_node;
331 while (dsync_mailbox_tree_iter_next(iter, &name, &node)) {
332 if (dsync_mailbox_tree_guid_hash_add(tree, node, &old_node) < 0) {
333 *dup_node1_r = node;
368 /* find node by GUID */
372 /* find node by name. this is a bit tricky, since the hierarchy
399 struct dsync_mailbox_node *node;
408 node = dsync_mailbox_tree_get(dest_tree, str_c(path));
410 node->ns = src->ns;
411 memcpy(node->mailbox_guid, src->mailbox_guid,
412 sizeof(node->mailbox_guid));
413 node->uid_validity = src->uid_validity;
414 node->uid_next = src->uid_next;
415 node->existence = src->existence;
416 node->last_renamed_or_created = src->last_renamed_or_created;
417 node->subscribed = src->subscribed;
418 node->last_subscription_change = src->last_subscription_change;
504 const char *dsync_mailbox_node_to_string(const struct dsync_mailbox_node *node)
507 guid_128_to_string(node->mailbox_guid),
508 node->uid_validity, node->uid_next,
509 node->subscribed ? "yes" : "no",
510 (long)node->last_renamed_or_created,
511 (long)node->last_subscription_change);