bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2005-2018 Dovecot authors, see the included COPYING file */
bd63b5b860658b01b1f46f26d406e1e4a9dc019aTimo Sirainenconst char *doveadm_quota_plugin_version = DOVECOT_ABI_VERSION;
9563e6542b7a8a13b13a0ef62ec68b0383b99293Timo Sirainenvoid doveadm_quota_plugin_init(struct module *module);
f4bc02a62f7f0c6e08f84a2b0e535466c012df04Martti Rannanjärvistatic int cmd_quota_get_root(struct quota_root *root)
f4bc02a62f7f0c6e08f84a2b0e535466c012df04Martti Rannanjärvi qret = quota_get_resource(root, "", *res, &value, &limit, &error);
f4bc02a62f7f0c6e08f84a2b0e535466c012df04Martti Rannanjärvi } else if (qret == QUOTA_GET_RESULT_UNLIMITED) {
cf41318871bd42358df3420e50614f5310b08c77Martti Rannanjärvi i_error("Failed to get quota resource %s: %s",
f4bc02a62f7f0c6e08f84a2b0e535466c012df04Martti Rannanjärvicmd_quota_get_run(struct doveadm_mail_cmd_context *ctx,
bc85bdcdebb2224e45e6c2bbc288e9ce59f651d9Timo Sirainen struct quota_user *quser = QUOTA_USER_CONTEXT(user);
5fbccc935e3f7b916aa7c6e302a212821072e83aTimo Sirainen doveadm_mail_failed_error(ctx, MAIL_ERROR_NOTFOUND);
f4bc02a62f7f0c6e08f84a2b0e535466c012df04Martti Rannanjärvi doveadm_mail_failed_error(ctx, MAIL_ERROR_TEMP);
f24b881d73ecb71938c9f46faa607529c0c58cd5Timo Sirainenstatic void cmd_quota_get_init(struct doveadm_mail_cmd_context *ctx ATTR_UNUSED,
7ed711d973b319320da100d3e905ef7b99ed69d6Timo Sirainen doveadm_print_header("root", "Quota name", 0);
bc10373fc050eb9dd23f6ed5ee8207d0e4d142eeTimo Sirainen ctx = doveadm_mail_cmd_alloc(struct doveadm_mail_cmd_context);
cf63dc8723b971cc80638fccbf494d961cbafc7fTimo Sirainencmd_quota_recalc_run(struct doveadm_mail_cmd_context *ctx ATTR_UNUSED,
bc85bdcdebb2224e45e6c2bbc288e9ce59f651d9Timo Sirainen struct quota_user *quser = QUOTA_USER_CONTEXT(user);
5fbccc935e3f7b916aa7c6e302a212821072e83aTimo Sirainen doveadm_mail_failed_error(ctx, MAIL_ERROR_NOTFOUND);
7b3b617e946d5b32078baa821f5fc05f775e1dfeMartti Rannanjärvi if ((*root)->backend.v.update(*root, &trans, &error) < 0)
7b3b617e946d5b32078baa821f5fc05f775e1dfeMartti Rannanjärvi i_error("Recalculating quota failed: %s", error);
bc10373fc050eb9dd23f6ed5ee8207d0e4d142eeTimo Sirainen ctx = doveadm_mail_cmd_alloc(struct doveadm_mail_cmd_context);
e6e5687226dc976061bffac9e7410ff14244e54fAki Tuomistatic struct doveadm_cmd_ver2 quota_commands[] = {
9563e6542b7a8a13b13a0ef62ec68b0383b99293Timo Sirainenvoid doveadm_quota_plugin_init(struct module *module ATTR_UNUSED)
bc85bdcdebb2224e45e6c2bbc288e9ce59f651d9Timo Sirainen unsigned int i;
bc85bdcdebb2224e45e6c2bbc288e9ce59f651d9Timo Sirainen for (i = 0; i < N_ELEMENTS(quota_commands); i++)