dovecot-2.2: quota-dict: Added "no-unset" parameter.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Oct 22 10:55:38 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/20b381fd95d0
changeset: 19329:20b381fd95d0
user: Timo Sirainen <tss at iki.fi>
date: Thu Oct 22 13:55:27 2015 +0300
description:
quota-dict: Added "no-unset" parameter.
diffstat:
src/plugins/quota/quota-dict.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diffs (39 lines):
diff -r 4bcca8a822dc -r 20b381fd95d0 src/plugins/quota/quota-dict.c
--- a/src/plugins/quota/quota-dict.c Wed Oct 21 19:12:45 2015 +0300
+++ b/src/plugins/quota/quota-dict.c Thu Oct 22 13:55:27 2015 +0300
@@ -17,6 +17,7 @@
struct quota_root root;
struct dict *dict;
struct timeout *to_update;
+ bool disable_unset;
};
extern struct quota_backend quota_backend_dict;
@@ -57,6 +58,9 @@
} else if (strncmp(args, "ignoreunlimited:", 16) == 0) {
_root->disable_unlimited_tracking = TRUE;
args += 16;
+ } else if (strncmp(args, "no-unset:", 9) == 0) {
+ root->disable_unset = TRUE;
+ args += 9;
} else if (strncmp(args, "ns=", 3) == 0) {
p = strchr(args, ':');
if (p == NULL)
@@ -126,9 +130,14 @@
T_BEGIN {
dt = dict_transaction_begin(root->dict);
/* these unsets are mainly necessary for pgsql, because its
- trigger otherwise increases quota without deleting it */
- dict_unset(dt, DICT_QUOTA_CURRENT_BYTES_PATH);
- dict_unset(dt, DICT_QUOTA_CURRENT_COUNT_PATH);
+ trigger otherwise increases quota without deleting it.
+ but some people with other databases want to store the
+ quota usage among other data in the same row, which
+ shouldn't be deleted. */
+ if (!root->disable_unset) {
+ dict_unset(dt, DICT_QUOTA_CURRENT_BYTES_PATH);
+ dict_unset(dt, DICT_QUOTA_CURRENT_COUNT_PATH);
+ }
dict_set(dt, DICT_QUOTA_CURRENT_BYTES_PATH, dec2str(bytes));
dict_set(dt, DICT_QUOTA_CURRENT_COUNT_PATH, dec2str(count));
} T_END;
More information about the dovecot-cvs
mailing list