/* Copyright (c) 2017-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "ioloop.h"
#include "imap-arg.h"
#include "imapc-storage.h"
#include "mailbox-list-private.h"
#include "quota-private.h"
struct imapc_quota_refresh_root {
const char *name;
unsigned int order;
};
struct imapc_quota_refresh {
const char *box_name;
};
struct imapc_quota_root {
bool initialized;
};
extern struct quota_backend quota_backend_imapc;
{
}
{
}
{
}
const char **error_r)
{
{.param_name = NULL}
};
return -1;
/* we'll never try to enforce the quota - it's just a lot of
unnecessary remote GETQUOTA calls. */
return 0;
}
{
}
static void
struct mail_namespace *ns)
{
}
static struct imapc_quota_refresh *
{
/* find the quota root that is being refreshed */
(struct imapc_quota_root *)*rootp;
}
}
return NULL;
}
static struct imapc_quota_refresh_root *
const char *root_name)
{
return refresh_root;
}
return refresh_root;
}
struct imapc_storage_client *client)
{
unsigned int i;
return;
/* unsolicited QUOTAROOT reply - ignore */
return;
}
/* duplicate QUOTAROOT reply - ignore */
return;
}
i = 1;
refresh_root->order = i;
i++;
}
}
struct imapc_storage_client *client)
{
unsigned int i;
return;
/* unsolicited QUOTA reply - ignore */
return;
}
/* RFC2087 uses 32bit number, but be ready for future */
return;
}
}
}
{
if (root->initialized)
/* non-imapc namespace, skip */
if ((storage->class_flags &
MAIL_STORAGE_CLASS_FLAG_NOQUOTA) == 0) {
i_warning("quota: Namespace '%s' is not imapc, "
"skipping for imapc quota",
}
return FALSE;
}
return TRUE;
}
{
}
static void
struct imapc_quota_refresh *refresh)
{
i_error("quota: imapc didn't return any QUOTA results");
return;
}
/* use the first quota root for everything */
(struct imapc_quota_root *)*rootp;
}
}
}
static void
{
if (success)
}
static int
const struct imapc_quota_refresh_root *root2)
{
return -1;
return 1;
else
return 0;
}
const char **error_r)
{
/* ask quotas for the configured mailbox */
/* if there are multiple quota roots, use the first one returned by
the QUOTAROOT */
"GETQUOTAROOT %s failed: %s",
}
const char **error_r)
{
/* ask quotas for the configured quota root */
/* there shouldn't be more than one QUOTA reply, but ignore anyway
anything we didn't expect. */
break;
}
"GETQUOTA %s failed: %s",
}
const char **error_r)
{
int ret;
/* imapc namespace is missing - disable this quota backend */
return 0;
}
return 0;
if (!imapc_quota_client_init(root))
return 0;
*error_r = "Failed to get server capabilities";
return -1;
}
if ((capa & IMAPC_CAPABILITY_QUOTA) == 0) {
/* no QUOTA capability - disable quota */
i_warning("quota: Remote IMAP server doesn't support QUOTA - disabling");
return 0;
}
else
/* set the last_refresh only after the refresh, because it changes
ioloop_timeval. */
return ret;
}
const char **error_r)
{
}
static void
{
unsigned int i, count;
for (i = 0; i < count; i++) {
}
}
static const char *const *
{
static const char *resources_both[] = {
};
return resources_both;
}
static enum quota_get_result
{
return QUOTA_GET_RESULT_INTERNAL_ERROR;
else {
}
return QUOTA_GET_RESULT_LIMITED;
}
static int
const char **error_r ATTR_UNUSED)
{
return 0;
}
.name = "imapc",
.v = {
.init = imapc_quota_init,
}
};