/* Copyright (c) 2005-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "str.h"
#include "dict.h"
#include "mail-user.h"
#include "mail-namespace.h"
#include "quota-private.h"
struct dict_quota_root {
bool disable_unset;
};
extern struct quota_backend quota_backend_dict;
{
}
{
}
const char **error_r)
{
{.param_name = NULL}
};
if (p == NULL) {
*error_r = "URI missing from parameters";
return -1;
}
args = p+1;
i_unreached();
if (*username == '\0')
i_debug("dict quota: user=%s, uri=%s, noenforcing=%d",
}
/* FIXME: we should use 64bit integer as datatype instead but before
it can actually be used don't bother */
return -1;
}
return 0;
}
{
}
}
static const char *const *
{
static const char *resources[] = {
};
return resources;
}
static enum quota_get_result
const char **error_r)
{
return error_res;
/* these unsets are mainly necessary for pgsql, because its
trigger otherwise increases quota without deleting it.
but some people with other databases want to store the
quota usage among other data in the same row, which
shouldn't be deleted. */
if (!root->disable_unset) {
}
i_debug("dict quota: Quota recalculated: "
}
return QUOTA_GET_RESULT_LIMITED;
}
static enum quota_get_result
const char **error_r)
{
bool want_bytes;
int ret;
want_bytes = TRUE;
want_bytes = FALSE;
else {
}
if (ret < 0) {
*value_r = 0;
return QUOTA_GET_RESULT_INTERNAL_ERROR;
}
/* recalculate quota if it's negative or if it wasn't found */
tmp = -1;
if (tmp >= 0)
else
return QUOTA_GET_RESULT_LIMITED;
}
{
const char *error;
}
void *context)
{
/* row doesn't exist, need to recalculate it */
i_error("dict quota: Quota update failed: %s "
}
}
static int
struct quota_transaction_context *ctx,
const char **error_r)
{
return -1;
} else {
if (ctx->bytes_used != 0) {
ctx->bytes_used);
}
if (ctx->count_used != 0) {
ctx->count_used);
}
root);
}
return 0;
}
{
}
}
.name = "dict",
.v = {
.init = dict_quota_init,
}
};