Lines Matching refs:quota
11 #include "quota-private.h"
12 #include "quota-plugin.h"
68 mailbox_set_critical(box, "quota: %s", internal_err);
92 physical size and do the quota freeing later when the message was
94 if (quser->quota->set->vsizes)
106 /* we're running dsync. if this brings the quota below
107 a negative quota warning, don't execute it, because
221 array_foreach(&quser->quota->roots, rootp) {
227 /* Both/neither have this quota */
229 /* Destination mailbox has a quota that doesn't exist
234 /* Source mailbox has a quota root that doesn't exist
236 quota, so ignore it. */
252 /* the mail is being moved. the quota won't increase (after
254 currently over quota */
268 i_error("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
272 background quota calculation, allow saving anyway. */
273 i_warning("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
291 /* get quota before copying any mails. this avoids dovecot-vsize.lock
297 i_warning("quota: %s - copying mail anyway", error);
299 i_error("quota: %s - copying mail anyway", error);
307 quota */
324 /* Input size is known, check for quota immediately. This
331 benefit of giving "out of quota" error before sending the
341 i_error("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
345 * ongoing background quota calculation, allow saving
347 i_warning("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
358 /* get quota before copying any mails. this avoids dovecot-vsize.lock
363 i_warning("quota: %s - saving mail anyway", error);
365 i_error("quota: %s - saving mail anyway", error);
444 we saved earlier, or recalculate the whole quota if we don't know
473 if (ibox->vsize_update != NULL && quser->quota->set->vsizes)
483 cause a quota recalculation. */
487 qbox->expunge_trans = mailbox_transaction_begin(box, 0, "quota");
495 else if (!quser->quota->set->vsizes) {
505 /* there's no way to get the size. recalculate the quota. */
518 /* update quota only after syncing is finished. the quota commit may
519 recalculate the quota and cause all mailboxes to be synced,
525 static void quota_roots_flush(struct quota *quota)
530 roots = array_get("a->roots, &count);
546 /* make sure quota backend flushes all data. this could also be done
548 can trigger quota recalculation which isn't safe to do anymore
551 quota_roots_flush(quser->quota);
608 struct quota *quota_get_mail_user_quota(struct mail_user *user)
612 return quser == NULL ? NULL : quser->quota;
618 struct quota_settings *quota_set = quser->quota->set;
620 quota_deinit(&quser->quota);
631 struct quota *quota;
636 if (quota_init(set, user, "a, &error) < 0) {
644 "Failed to initialize quota: %s", error);
652 quser->quota = quota;
656 i_debug("quota: No quota setting - plugin disabled");
661 quota_find_root_for_ns(struct quota *quota, struct mail_namespace *ns)
666 roots = array_get("a->roots, &count);
678 struct quota *quota = NULL;
683 /* see if we have a quota explicitly defined for this namespace */
684 quota = quota_get_mail_user_quota(list->ns->user);
685 if (quota == NULL)
687 root = quota_find_root_for_ns(quota, list->ns);
689 /* explicit quota root */
700 /* public namespace - add quota only if namespace is
704 /* for shared namespaces add only if the owner has quota
718 quota = quota_get_mail_user_quota(quota_user);
719 i_assert(quota != NULL);
720 quota_add_user_namespace(quota, list->ns);
737 i_error("quota: Unknown namespace: %s",
747 i_error("quota: Unknown namespace: %s", name);
753 struct quota *quota;
757 quota = quota_get_mail_user_quota(namespaces->user);
758 if (quota == NULL)
760 roots = array_get("a->roots, &count);
764 quota_over_flag_check_startup(quota);