dovecot: Added quota_exceeded_message setting.

dovecot at dovecot.org dovecot at dovecot.org
Fri Jan 11 07:07:13 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/740a17139b67
changeset: 7147:740a17139b67
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jan 11 07:07:09 2008 +0200
description:
Added quota_exceeded_message setting.

diffstat:

3 files changed, 8 insertions(+), 2 deletions(-)
src/plugins/quota/quota-private.h |    1 +
src/plugins/quota/quota-storage.c |    5 +++--
src/plugins/quota/quota.c         |    4 ++++

diffs (54 lines):

diff -r ca223be145b5 -r 740a17139b67 src/plugins/quota/quota-private.h
--- a/src/plugins/quota/quota-private.h	Fri Jan 11 05:49:34 2008 +0200
+++ b/src/plugins/quota/quota-private.h	Fri Jan 11 07:07:09 2008 +0200
@@ -15,6 +15,7 @@ struct quota {
 	int (*test_alloc)(struct quota_transaction_context *ctx,
 			  uoff_t size, bool *too_large_r);
 
+	const char *quota_exceeded_msg;
 	unsigned int debug:1;
 };
 
diff -r ca223be145b5 -r 740a17139b67 src/plugins/quota/quota-storage.c
--- a/src/plugins/quota/quota-storage.c	Fri Jan 11 05:49:34 2008 +0200
+++ b/src/plugins/quota/quota-storage.c	Fri Jan 11 07:07:09 2008 +0200
@@ -150,7 +150,7 @@ static int quota_check(struct mailbox_tr
 		return 0;
 	else if (ret == 0) {
 		mail_storage_set_error(t->box->storage, MAIL_ERROR_NOSPACE,
-				       "Quota exceeded");
+				       qt->quota->quota_exceeded_msg);
 		return -1;
 	} else {
 		mail_storage_set_critical(t->box->storage,
@@ -214,7 +214,8 @@ quota_save_init(struct mailbox_transacti
 		ret = quota_test_alloc(qt, st->st_size, &too_large);
 		if (ret == 0) {
 			mail_storage_set_error(t->box->storage,
-				MAIL_ERROR_NOSPACE, "Quota exceeded");
+				MAIL_ERROR_NOSPACE,
+				qt->quota->quota_exceeded_msg);
 			return -1;
 		} else if (ret < 0) {
 			mail_storage_set_critical(t->box->storage,
diff -r ca223be145b5 -r 740a17139b67 src/plugins/quota/quota.c
--- a/src/plugins/quota/quota.c	Fri Jan 11 05:49:34 2008 +0200
+++ b/src/plugins/quota/quota.c	Fri Jan 11 07:07:09 2008 +0200
@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <sys/wait.h>
 
+#define DEFAULT_QUOTA_EXCEEDED_MSG "Quota exceeded"
 #define RULE_NAME_ALL_MAILBOXES "*"
 
 struct quota_root_iter {
@@ -46,6 +47,9 @@ struct quota *quota_init(void)
 	quota = i_new(struct quota, 1);
 	quota->test_alloc = quota_default_test_alloc;
 	quota->debug = getenv("DEBUG") != NULL;
+	quota->quota_exceeded_msg = getenv("QUOTA_EXCEEDED_MESSAGE");
+	if (quota->quota_exceeded_msg == NULL)
+		quota->quota_exceeded_msg = DEFAULT_QUOTA_EXCEEDED_MSG;
 	i_array_init(&quota->roots, 4);
 	i_array_init(&quota->storages, 8);
 


More information about the dovecot-cvs mailing list