quota-clone-plugin.c revision a022e47f45597650f71f00c3af3fa783982a65ad
/* Copyright (c) 2015-2017 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "module-context.h"
#include "ioloop.h"
#include "dict.h"
#include "mail-storage-private.h"
#include "quota.h"
#include "quota-clone-plugin.h"
/* If mailbox is kept open for this many milliseconds after quota update,
flush quota-clone. */
#define QUOTA_CLONE_USER_CONTEXT(obj) \
#define QUOTA_CLONE_CONTEXT(obj) \
struct quota_clone_user {
bool quota_flushing;
};
struct quota_clone_mailbox {
union mailbox_module_context module_ctx;
struct timeout *to_quota_flush;
bool quota_changed;
};
{
struct quota_clone_user *quser =
struct dict_transaction_context *trans;
struct quota_root_iter *iter;
struct quota_root *root;
const char *error;
/* we'll clone the first quota root */
/* no quota roots defined for this mailbox - ignore */
return;
}
/* get new values first */
&bytes_value, &limit);
if (ret_bytes < 0) {
i_error("quota_clone_plugin: Failed to lookup current quota bytes");
return;
}
&count_value, &limit);
if (ret_count < 0) {
i_error("quota_clone_plugin: Failed to lookup current quota count");
return;
}
/* quota isn't enabled - no point in updating it */
return;
}
/* Then update the resources that exist. The resources can't really
change unless the quota backend is changed, so we don't worry about
the special case of ret_count changing between 1 and 0. Note that
ret_count==1 also when quota is unlimited. */
if (ret_bytes > 0) {
}
if (ret_count > 0) {
}
else
}
{
struct quota_clone_user *quser =
if (quser->quota_flushing) {
/* recursing back from quota recalculation */
} else if (qbox->quota_changed) {
}
}
{
}
}
{
struct quota_clone_mailbox *qbox =
}
static int
{
struct quota_clone_mailbox *qbox =
}
static void
enum mailbox_sync_type sync_type)
{
if (sync_type == MAILBOX_SYNC_TYPE_EXPUNGE)
}
{
}
{
struct quota_clone_user *quser =
struct quota_clone_mailbox *qbox;
return;
v->copy = quota_clone_copy;
}
{
}
{
struct quota_clone_user *quser;
struct dict_settings dict_set;
if (user->mail_debug) {
i_debug("The quota_clone_dict setting is missing from configuration");
}
return;
}
i_error("quota_clone_dict: Failed to initialize '%s': %s",
return;
}
}
static struct mail_storage_hooks quota_clone_mail_storage_hooks = {
};
{
}
void quota_clone_plugin_deinit(void)
{
}