dovecot-1.2: quota debug: Hide "(0%)" if quota limits aren't def...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jan 21 19:40:10 EET 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/14b9a90eb01d
changeset: 8669:14b9a90eb01d
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jan 21 12:40:06 2009 -0500
description:
quota debug: Hide "(0%)" if quota limits aren't defined defined in percentages.

diffstat:

1 file changed, 14 insertions(+), 7 deletions(-)
src/plugins/quota/quota.c |   21 ++++++++++++++-------

diffs (41 lines):

diff -r 1cea5aa6915c -r 14b9a90eb01d src/plugins/quota/quota.c
--- a/src/plugins/quota/quota.c	Wed Jan 21 12:30:15 2009 -0500
+++ b/src/plugins/quota/quota.c	Wed Jan 21 12:40:06 2009 -0500
@@ -422,10 +422,14 @@ int quota_root_add_rule(struct quota_roo
 	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 q
 
 	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;
 }


More information about the dovecot-cvs mailing list