Lines Matching refs:rule

17 	struct quota_rule *rule;
19 array_foreach_modifiable(&root_set->rules, rule) {
20 if (wildcard_match(name, rule->mailbox_mask))
21 return rule;
30 struct quota_rule *rule;
32 array_foreach_modifiable(&root_set->rules, rule) {
33 if (strcmp(rule->mailbox_mask, name) == 0)
34 return rule;
41 struct quota_rule *rule,
51 if (rule == &root_set->default_rule) {
52 *error_r = "Default rule can't be a percentage";
56 if (limit == &rule->bytes_limit)
57 rule->bytes_percent = percentage;
58 else if (limit == &rule->count_limit)
59 rule->count_percent = percentage;
66 struct quota_rule *rule, const char *unit,
91 if (quota_rule_parse_percentage(root_set, rule, limit,
104 quota_rule_recalculate_relative_rules(struct quota_rule *rule,
107 if (rule->bytes_percent != 0)
108 rule->bytes_limit = bytes_limit * rule->bytes_percent / 100;
109 if (rule->count_percent != 0)
110 rule->count_limit = count_limit * rule->count_percent / 100;
117 struct quota_rule *rule;
120 array_foreach_modifiable(&root_set->rules, rule) {
121 quota_rule_recalculate_relative_rules(rule, bytes_limit,
126 quota_rule_recalculate_relative_rules(&warning_rule->rule,
143 struct quota_rule *rule, const char *limits,
170 i_warning("quota root %s rule %s: "
171 "obsolete configuration for rule '%s' "
179 limit = &rule->bytes_limit;
186 limit = &rule->bytes_limit;
193 limit = &rule->count_limit;
201 "Unknown rule limit name: %s", key);
205 if (quota_limit_parse(root_set, rule, p, multiply,
208 "Invalid rule limit value '%s': %s",
214 if (rule->bytes_limit < 0) {
218 if (rule->count_limit < 0) {
229 struct quota_rule *rule;
235 *error_r = "Invalid rule";
242 rule = quota_root_rule_find_exact(root_set, mailbox_mask);
243 if (rule == NULL) {
245 rule = &root_set->default_rule;
247 rule = &root_set->default_rule;
250 rule = array_append_space(&root_set->rules);
251 rule->mailbox_mask = strcasecmp(mailbox_mask, "INBOX") == 0 ? "INBOX" :
257 rule->ignore = TRUE;
259 i_debug("Quota rule: root=%s mailbox=%s ignored",
267 *error_r = "backend rule not supported";
269 } else if (!root_set->backend->v.parse_rule(root_set, rule,
273 bool relative_rule = rule != &root_set->default_rule;
275 if (quota_rule_parse_limits(root_set, rule, p, rule_def,
285 rule == &root_set->default_rule ? "" : "+";
287 i_debug("Quota rule: root=%s mailbox=%s "
290 rule->bytes_limit > 0 ? rule_plus : "",
291 (long long)rule->bytes_limit,
292 rule->bytes_percent == 0 ? "" :
293 t_strdup_printf(" (%u%%)", rule->bytes_percent),
294 rule->count_limit > 0 ? rule_plus : "",
295 (long long)rule->count_limit,
296 rule->count_percent == 0 ? "" :
297 t_strdup_printf(" (%u%%)", rule->count_percent));
306 struct quota_rule rule;
329 i_zero(&rule);
330 ret = quota_rule_parse_limits(root_set, &rule, t_strdup_until(q, p),
337 warning->rule = rule;
348 warning->rule.bytes_limit,
349 warning->rule.bytes_percent == 0 ? "" :
350 t_strdup_printf(" (%u%%)", warning->rule.bytes_percent),
351 warning->rule.count_limit,
352 warning->rule.count_percent == 0 ? "" :
353 t_strdup_printf(" (%u%%)", warning->rule.count_percent),
396 if (QUOTA_EXCEEDED(bytes_before, bytes_current, w->rule.bytes_limit)) {
398 bytes_before, bytes_current, w->rule.bytes_limit);
401 if (QUOTA_EXCEEDED(count_before, count_current, w->rule.count_limit)) {
403 count_before, count_current, w->rule.count_limit);
407 if (QUOTA_EXCEEDED(bytes_current, bytes_before, w->rule.bytes_limit)) {
409 bytes_before, bytes_current, w->rule.bytes_limit);
412 if (QUOTA_EXCEEDED(count_current, count_before, w->rule.count_limit)) {
414 count_before, count_current, w->rule.count_limit);