Lines Matching defs:root

26 	struct quota_root root;
43 struct imapc_quota_root *root;
45 root = i_new(struct imapc_quota_root, 1);
46 return &root->root;
62 struct imapc_quota_root *root = (struct imapc_quota_root *)_root;
65 {.param_name = "root=", .param_handler = handle_root_param},
75 if (root->box_name == NULL && root->root_name == NULL)
76 root->box_name = "INBOX";
92 struct imapc_quota_root *root = (struct imapc_quota_root *)_root;
94 if (root->imapc_ns == NULL)
95 root->imapc_ns = ns;
109 /* find the quota root that is being refreshed */
112 struct imapc_quota_root *root =
115 if (root->refresh.pool != NULL)
116 return &root->refresh;
210 static bool imapc_quota_client_init(struct imapc_quota_root *root)
215 if (root->initialized)
216 return root->client != NULL;
217 root->initialized = TRUE;
219 list = root->imapc_ns->list;
227 root->imapc_ns->prefix);
231 root->client = ((struct imapc_storage *)storage)->client;
233 imapc_storage_client_register_untagged(root->client, "QUOTAROOT",
235 imapc_storage_client_register_untagged(root->client, "QUOTA",
259 /* use the first quota root for everything */
264 struct imapc_quota_root *root =
267 root->bytes_last = refresh_root->bytes_cur;
268 root->count_last = refresh_root->count_cur;
269 root->root.bytes_limit = refresh_root->bytes_limit;
270 root->root.count_limit = refresh_root->count_limit;
297 static int imapc_quota_refresh_mailbox(struct imapc_quota_root *root,
303 i_assert(root->box_name != NULL);
306 imapc_quota_refresh_init(&root->refresh);
307 root->refresh.box_name = root->box_name;
309 imapc_simple_context_init(&sctx, root->client);
310 cmd = imapc_client_cmd(root->client->client,
312 imapc_command_sendf(cmd, "GETQUOTAROOT %s", root->box_name);
317 array_sort(&root->refresh.roots, imapc_quota_refresh_root_order_cmp);
318 imapc_quota_refresh_deinit(root->root.quota, &root->refresh,
323 root->box_name,
325 &root->client->_storage->storage, NULL));
330 static int imapc_quota_refresh_root(struct imapc_quota_root *root,
336 i_assert(root->root_name != NULL);
338 /* ask quotas for the configured quota root */
339 imapc_quota_refresh_init(&root->refresh);
341 imapc_simple_context_init(&sctx, root->client);
342 cmd = imapc_client_cmd(root->client->client,
344 imapc_command_sendf(cmd, "GETQUOTA %s", root->root_name);
349 while (array_count(&root->refresh.roots) > 0) {
351 array_idx(&root->refresh.roots, 0);
352 if (strcmp(refresh_root->name, root->root_name) == 0)
354 array_delete(&root->refresh.roots, 0, 1);
356 imapc_quota_refresh_deinit(root->root.quota, &root->refresh,
361 root->root_name,
363 &root->client->_storage->storage, NULL));
367 static int imapc_quota_refresh(struct imapc_quota_root *root,
373 if (root->imapc_ns == NULL) {
377 if (root->last_refresh.tv_sec == ioloop_timeval.tv_sec &&
378 root->last_refresh.tv_usec == ioloop_timeval.tv_usec)
380 if (!imapc_quota_client_init(root))
383 if (imapc_client_get_capabilities(root->client->client, &capa) < 0) {
390 root->client = NULL;
394 if (root->root_name == NULL)
395 ret = imapc_quota_refresh_mailbox(root, error_r);
397 ret = imapc_quota_refresh_root(root, error_r);
401 root->last_refresh = ioloop_timeval;
408 struct imapc_quota_root *root = (struct imapc_quota_root *)_root;
410 return imapc_quota_refresh(root, error_r);
430 imapc_quota_root_get_resources(struct quota_root *root ATTR_UNUSED)
444 struct imapc_quota_root *root = (struct imapc_quota_root *)_root;
446 if (imapc_quota_refresh(root, error_r) < 0)
450 *value_r = root->bytes_last;
452 *value_r = root->count_last;
461 imapc_quota_update(struct quota_root *root ATTR_UNUSED,