bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2005-2018 Dovecot authors, see the included COPYING file */
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen#include "lib.h"
5666a3d6a7ea89362b8d9e8b39b15424cd9d6388Timo Sirainen#include "mail-user.h"
5666a3d6a7ea89362b8d9e8b39b15424cd9d6388Timo Sirainen#include "mail-storage-hooks.h"
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen#include "quota-plugin.h"
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
bd2a176b573f9679e7e45339c20ef71704f071c0Aki Tuomivoid quota_backends_register(void);
bd2a176b573f9679e7e45339c20ef71704f071c0Aki Tuomivoid quota_backends_unregister(void);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
bd63b5b860658b01b1f46f26d406e1e4a9dc019aTimo Sirainenconst char *quota_plugin_version = DOVECOT_ABI_VERSION;
503e5ef896c7b4a51cf73efb0d132860a8c747e6Timo Sirainen
5666a3d6a7ea89362b8d9e8b39b15424cd9d6388Timo Sirainenstatic struct mail_storage_hooks quota_mail_storage_hooks = {
5666a3d6a7ea89362b8d9e8b39b15424cd9d6388Timo Sirainen .mail_user_created = quota_mail_user_created,
5666a3d6a7ea89362b8d9e8b39b15424cd9d6388Timo Sirainen .mail_namespaces_created = quota_mail_namespaces_created,
d7c2ae49f036ef256f63bd2d437c53da122c665eTimo Sirainen .mailbox_list_created = quota_mailbox_list_created,
539977f9257bd8985be5a8093658da266ae9cd19Timo Sirainen .mailbox_allocated = quota_mailbox_allocated,
539977f9257bd8985be5a8093658da266ae9cd19Timo Sirainen .mail_allocated = quota_mail_allocated
5666a3d6a7ea89362b8d9e8b39b15424cd9d6388Timo Sirainen};
2d8b23805db6f06b8b38174fb6e135386694f429Timo Sirainen
5666a3d6a7ea89362b8d9e8b39b15424cd9d6388Timo Sirainenvoid quota_plugin_init(struct module *module)
5666a3d6a7ea89362b8d9e8b39b15424cd9d6388Timo Sirainen{
5666a3d6a7ea89362b8d9e8b39b15424cd9d6388Timo Sirainen mail_storage_hooks_add(module, &quota_mail_storage_hooks);
bd2a176b573f9679e7e45339c20ef71704f071c0Aki Tuomi quota_backends_register();
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen}
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenvoid quota_plugin_deinit(void)
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen{
5666a3d6a7ea89362b8d9e8b39b15424cd9d6388Timo Sirainen mail_storage_hooks_remove(&quota_mail_storage_hooks);
bd2a176b573f9679e7e45339c20ef71704f071c0Aki Tuomi quota_backends_unregister();
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen}