quota-private.h revision 2615df45a8027948a474abe5e817b34b0499c171
#ifndef QUOTA_PRIVATE_H
#define QUOTA_PRIVATE_H
#include "mail-storage-private.h"
#include "mail-namespace.h"
#include "quota.h"
/* Modules should use do "my_id = quota_module_id++" and
use quota_module_contexts[id] for their own purposes. */
extern unsigned int quota_module_id;
struct quota {
struct quota_settings *set;
};
struct quota_settings {
const char *quota_exceeded_msg;
unsigned int debug:1;
};
struct quota_rule {
const char *mailbox_name;
/* relative to default_rule */
unsigned int bytes_percent, count_percent;
/* Don't include this mailbox in quota */
unsigned int ignore:1;
};
struct quota_warning_rule {
struct quota_rule rule;
const char *command;
};
struct quota_backend_vfuncs {
struct quota_root *(*alloc)(void);
struct quota_rule *rule,
/* called once for each namespace */
struct mail_namespace *ns);
struct quota_transaction_context *ctx);
};
struct quota_backend {
/* quota backends equal if backend1.name == backend2.name */
const char *name;
struct quota_backend_vfuncs v;
};
struct quota_root_settings {
/* Unique quota root name. */
const char *name;
struct quota_settings *set;
const char *args;
const struct quota_backend *backend;
struct quota_rule default_rule;
/* Limits in default_rule override backend's quota limits */
unsigned int force_default_rule:1;
};
struct quota_root {
struct quota_root_settings *set;
struct quota_backend backend;
/* this quota root applies only to this namespace. it may also be
a public namespace without an owner. */
struct mail_namespace *ns;
/* this is set in quota init(), because namespaces aren't known yet */
const char *ns_prefix;
/* initially the same as set->default_rule.*_limit, but some backends
may change these by reading the limits elsewhere (e.g. Maildir++,
FS quota) */
/* 1 = quota root has resources and should be returned when iterating
quota roots, 0 = not, -1 = unknown. */
int resource_ret;
/* Module-specific contexts. See quota_module_id. */
ARRAY_DEFINE(quota_module_contexts, void);
/* don't enforce quota when saving */
unsigned int no_enforcing:1;
};
struct quota_transaction_context {
unsigned int limits_set:1;
unsigned int failed:1;
unsigned int recalculate:1;
};
/* Register storage to all user's quota roots. */
struct mail_namespace *ns);
struct quota_rule *
#endif