From: Timo Sirainen Date: Wed, 21 Jan 2009 17:40:06 +0000 (-0500) Subject: quota debug: Hide "(0%)" if quota limits aren't defined defined in percentages. X-Git-Tag: 1.2.beta1~74 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9c2092c1f7027803b9c00b16849e8ff355177237;p=thirdparty%2Fdovecot%2Fcore.git quota debug: Hide "(0%)" if quota limits aren't defined defined in percentages. --HG-- branch : HEAD --- diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index 608308e131..eec3c5a632 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -422,10 +422,14 @@ int quota_root_add_rule(struct quota_root_settings *root_set, quota_root_recalculate_relative_rules(root_set); if (root_set->set->debug) { i_info("Quota rule: root=%s mailbox=%s " - "bytes=%lld (%u%%) messages=%lld (%u%%)", root_set->name, + "bytes=%lld%s messages=%lld%s", root_set->name, mailbox_name, - (long long)rule->bytes_limit, rule->bytes_percent, - (long long)rule->count_limit, rule->count_percent); + (long long)rule->bytes_limit, + rule->bytes_percent == 0 ? "" : + t_strdup_printf(" (%u%%)", rule->bytes_percent), + (long long)rule->count_limit, + rule->count_percent == 0 ? "" : + t_strdup_printf(" (%u%%)", rule->count_percent)); } return ret; } @@ -570,12 +574,15 @@ int quota_root_add_warning_rule(struct quota_root_settings *root_set, quota_root_recalculate_relative_rules(root_set); if (root_set->set->debug) { - i_info("Quota warning: bytes=%llu (%u%%) " - "messages=%llu (%u%%) command=%s", + i_info("Quota warning: bytes=%llu%s " + "messages=%llu%s command=%s", (unsigned long long)warning->rule.bytes_limit, - warning->rule.bytes_percent, + warning->rule.bytes_percent == 0 ? "" : + t_strdup_printf(" (%u%%)", warning->rule.bytes_percent), (unsigned long long)warning->rule.count_limit, - warning->rule.count_percent, warning->command); + warning->rule.count_percent == 0 ? "" : + t_strdup_printf(" (%u%%)", warning->rule.count_percent), + warning->command); } return 0; }