quota-dict.c revision e48f289d2e5b2546a2c5dcc90f7ab624cc58cca2
/* Copyright (c) 2005-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "dict.h"
#include "mail-user.h"
#include "mail-namespace.h"
#include "quota-private.h"
#include <stdlib.h>
struct dict_quota_root {
struct quota_root root;
};
extern struct quota_backend quota_backend_dict;
static struct quota_root *dict_quota_alloc(void)
{
struct dict_quota_root *root;
}
const char **error_r)
{
struct dict_settings set;
if (p == NULL) {
*error_r = "URI missing from parameters";
return -1;
}
args = p+1;
for (;;) {
/* FIXME: pretty ugly in here. the parameters should have
been designed to be extensible. do it in a future version */
args += 12;
args += 7;
args += 16;
if (p == NULL)
break;
args + 3, p);
args = p + 1;
} else {
break;
}
}
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 int
{
struct dict_transaction_context *dt;
return -1;
T_BEGIN {
/* these unsets are mainly necessary for pgsql, because its
trigger otherwise increases quota without deleting it */
} T_END;
return 1;
}
static int
{
bool want_bytes;
int ret;
want_bytes = TRUE;
want_bytes = FALSE;
else
return 0;
T_BEGIN {
const char *value;
if (ret < 0)
*value_r = 0;
else {
/* recalculate quota if it's negative or if it
wasn't found */
tmp = -1;
if (tmp >= 0)
else {
value_r);
}
}
} T_END;
return ret;
}
{
if (ret == 0) {
/* row doesn't exist, need to recalculate it */
} else if (ret < 0) {
i_error("dict quota: Quota update failed, it's now desynced");
}
}
static int
struct quota_transaction_context *ctx)
{
struct dict_transaction_context *dt;
if (ctx->recalculate) {
return -1;
} else {
if (ctx->bytes_used != 0) {
ctx->bytes_used);
}
if (ctx->count_used != 0) {
ctx->count_used);
}
root);
}
return 0;
}
{
}
struct quota_backend quota_backend_dict = {
"dict",
{
NULL,
NULL,
NULL,
NULL,
}
};