[dovecot-cvs] dovecot/src/plugins/quota quota-dict.c, 1.9.2.5, 1.9.2.6 quota-dirsize.c, 1.10.2.1, 1.10.2.2 quota-fs.c, 1.14.2.8, 1.14.2.9 quota-maildir.c, 1.9.2.4, 1.9.2.5 quota-private.h, 1.7.2.2, 1.7.2.3 quota.c, 1.8.2.2, 1.8.2.3
tss at dovecot.org
tss at dovecot.org
Sun Dec 3 16:15:13 UTC 2006
Update of /var/lib/cvs/dovecot/src/plugins/quota
In directory talvi:/tmp/cvs-serv5576/plugins/quota
Modified Files:
Tag: branch_1_0
quota-dict.c quota-dirsize.c quota-fs.c quota-maildir.c
quota-private.h quota.c
Log Message:
Added ignore setting to maildir quota, which allows ignoring quota in Trash
mailbox.
Index: quota-dict.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-dict.c,v
retrieving revision 1.9.2.5
retrieving revision 1.9.2.6
diff -u -d -r1.9.2.5 -r1.9.2.6
--- quota-dict.c 10 Aug 2006 20:08:26 -0000 1.9.2.5
+++ quota-dict.c 3 Dec 2006 16:15:10 -0000 1.9.2.6
@@ -143,7 +143,8 @@
static struct quota_root_transaction_context *
dict_quota_transaction_begin(struct quota_root *_root,
- struct quota_transaction_context *_ctx)
+ struct quota_transaction_context *_ctx,
+ struct mailbox *box __attr_unused__)
{
struct dict_quota_root *root = (struct dict_quota_root *)_root;
struct quota_root_transaction_context *ctx;
Index: quota-dirsize.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-dirsize.c,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -u -d -r1.10.2.1 -r1.10.2.2
--- quota-dirsize.c 11 Jun 2006 17:34:48 -0000 1.10.2.1
+++ quota-dirsize.c 3 Dec 2006 16:15:10 -0000 1.10.2.2
@@ -259,7 +259,8 @@
static struct quota_root_transaction_context *
dirsize_quota_transaction_begin(struct quota_root *_root,
- struct quota_transaction_context *_ctx)
+ struct quota_transaction_context *_ctx,
+ struct mailbox *box __attr_unused__)
{
struct dirsize_quota_root *root = (struct dirsize_quota_root *)_root;
struct quota_root_transaction_context *ctx;
Index: quota-fs.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-fs.c,v
retrieving revision 1.14.2.8
retrieving revision 1.14.2.9
diff -u -d -r1.14.2.8 -r1.14.2.9
--- quota-fs.c 10 Aug 2006 22:03:22 -0000 1.14.2.8
+++ quota-fs.c 3 Dec 2006 16:15:10 -0000 1.14.2.9
@@ -282,7 +282,8 @@
static struct quota_root_transaction_context *
fs_quota_transaction_begin(struct quota_root *root,
- struct quota_transaction_context *ctx)
+ struct quota_transaction_context *ctx,
+ struct mailbox *box __attr_unused__)
{
struct quota_root_transaction_context *root_ctx;
Index: quota-maildir.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-maildir.c,v
retrieving revision 1.9.2.4
retrieving revision 1.9.2.5
diff -u -d -r1.9.2.4 -r1.9.2.5
--- quota-maildir.c 12 Nov 2006 20:04:19 -0000 1.9.2.4
+++ quota-maildir.c 3 Dec 2006 16:15:10 -0000 1.9.2.5
@@ -16,11 +16,13 @@
#include <dirent.h>
#include <sys/stat.h>
+#define MAILDIR_TRASH_MAILBOX "Trash"
#define MAILDIRSIZE_FILENAME "maildirsize"
#define MAILDIRSIZE_STALE_SECS (60*15)
struct maildir_quota_root {
struct quota_root root;
+ char *ignore;
uint64_t message_bytes_limit;
uint64_t message_count_limit;
@@ -34,6 +36,8 @@
};
struct maildir_list_context {
+ struct maildir_quota_root *root;
+
struct mailbox_list_context *ctx;
struct mailbox_list *list;
@@ -127,11 +131,12 @@
}
static struct maildir_list_context *
-maildir_list_init(struct mail_storage *storage)
+maildir_list_init(struct maildir_quota_root *root, struct mail_storage *storage)
{
struct maildir_list_context *ctx;
ctx = i_new(struct maildir_list_context, 1);
+ ctx->root = root;
ctx->path = str_new(default_pool, 512);
ctx->ctx = mail_storage_mailbox_list_init(storage, "", "*",
MAILBOX_LIST_FAST_FLAGS |
@@ -153,6 +158,10 @@
return NULL;
}
+ if (ctx->root->ignore != NULL &&
+ strcmp(ctx->list->name, ctx->root->ignore) == 0)
+ continue;
+
t_push();
path = mail_storage_get_mailbox_path(ctx->ctx->storage,
ctx->list->name,
@@ -190,14 +199,15 @@
}
static int
-maildirs_check_have_changed(struct mail_storage *storage, time_t latest_mtime)
+maildirs_check_have_changed(struct maildir_quota_root *root,
+ struct mail_storage *storage, time_t latest_mtime)
{
struct maildir_list_context *ctx;
const char *dir;
time_t mtime;
int ret = 0;
- ctx = maildir_list_init(storage);
+ ctx = maildir_list_init(root, storage);
while ((dir = maildir_list_next(ctx, &mtime)) != NULL) {
if (mtime > latest_mtime) {
ret = 1;
@@ -279,7 +289,7 @@
root->total_bytes = root->total_count = 0;
- ctx = maildir_list_init(storage);
+ ctx = maildir_list_init(root, storage);
while ((dir = maildir_list_next(ctx, &mtime)) != NULL) {
if (mtime > last_stamp)
last_stamp = mtime;
@@ -295,7 +305,7 @@
ret = -1;
if (ret == 0)
- ret = maildirs_check_have_changed(storage, last_stamp);
+ ret = maildirs_check_have_changed(root, storage, last_stamp);
t_push();
path = maildirsize_get_path(storage);
@@ -534,7 +544,7 @@
t_push();
args = t_strsplit(setup->data, ":");
- for (; *args != '\0'; args++) {
+ for (args++; *args != '\0'; args++) {
if (strncmp(*args, "storage=", 8) == 0) {
size = strtoull(*args + 8, NULL, 10) * 1024;
if (size != 0)
@@ -545,6 +555,11 @@
if (size != 0)
root->message_count_limit = size;
root->master_message_limits = TRUE;
+ } else if (strncmp(*args, "ignore=", 7) == 0) {
+ i_free(root->ignore);
+ root->ignore = i_strdup(*args + 7);
+ } else {
+ i_error("maildir quota: Unknown setting: %s", *args);
}
}
t_pop();
@@ -556,6 +571,7 @@
{
struct maildir_quota_root *root = (struct maildir_quota_root *)_root;
+ i_free(root->ignore);
i_free(root->root.name);
i_free(root);
}
@@ -644,7 +660,8 @@
static struct quota_root_transaction_context *
maildir_quota_transaction_begin(struct quota_root *_root,
- struct quota_transaction_context *_ctx)
+ struct quota_transaction_context *_ctx,
+ struct mailbox *box)
{
struct maildir_quota_root *root = (struct maildir_quota_root *)_root;
struct quota_root_transaction_context *ctx;
@@ -653,6 +670,13 @@
ctx->root = _root;
ctx->ctx = _ctx;
+ if (root->ignore != NULL &&
+ strcmp(mailbox_get_name(box), root->ignore) == 0) {
+ ctx->bytes_limit = (uint64_t)-1;
+ ctx->count_limit = (uint64_t)-1;
+ return ctx;
+ }
+
if (maildirquota_refresh(root,
maildir_quota_root_get_storage(_root)) < 0) {
/* failed calculating the current quota */
Index: quota-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-private.h,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -u -d -r1.7.2.2 -r1.7.2.3
--- quota-private.h 12 Nov 2006 18:48:28 -0000 1.7.2.2
+++ quota-private.h 3 Dec 2006 16:15:10 -0000 1.7.2.3
@@ -42,7 +42,8 @@
struct quota_root_transaction_context *
(*transaction_begin)(struct quota_root *root,
- struct quota_transaction_context *ctx);
+ struct quota_transaction_context *ctx,
+ struct mailbox *box);
int (*transaction_commit)(struct quota_root_transaction_context *ctx);
void (*transaction_rollback)
(struct quota_root_transaction_context *ctx);
Index: quota.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota.c,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.3
diff -u -d -r1.8.2.2 -r1.8.2.3
--- quota.c 11 Jun 2006 17:34:48 -0000 1.8.2.2
+++ quota.c 3 Dec 2006 16:15:10 -0000 1.8.2.3
@@ -238,7 +238,7 @@
iter = quota_root_iter_init(box);
while ((root = quota_root_iter_next(iter)) != NULL) {
- root_ctx = root->v.transaction_begin(root, ctx);
+ root_ctx = root->v.transaction_begin(root, ctx, box);
array_append(&ctx->root_transactions, &root_ctx, 1);
}
quota_root_iter_deinit(iter);
More information about the dovecot-cvs
mailing list