Best Regards, Thanos Chatziathanassiou
--- quota-dirsize.c.orig Tue Jan 6 16:33:51 2009
+++ quota-dirsize.c Fri Aug 21 16:03:46 2009
@@ -39,7 +39,7 @@
return resources;
}
-static int get_dir_usage(const char *dir, uint64_t *value)
+static int get_dir_usage(struct quota_root *root, const char *dir, uint64_t *value)
{
DIR *dirp;
string_t *path;
@@ -47,6 +47,7 @@
struct stat st;
unsigned int path_pos;
int ret;
+ struct quota_rule *rule;
dirp = opendir(dir);
if (dirp == NULL) {
@@ -82,11 +83,16 @@
ret = -1;
break;
} else if (S_ISDIR(st.st_mode)) {
- if (get_dir_usage(str_c(path), value) < 0) {
+ if (get_dir_usage(root, str_c(path), value) < 0) {
ret = -1;
break;
}
} else {
+ /* check if we need to ignore this one as well */
+ rule = quota_root_rule_find(root, d->d_name);
+ if (rule != NULL && rule->ignore)
+ continue;
+
*value += st.st_size;
}
}
@@ -95,7 +101,7 @@
return ret;
}
-static int get_usage(const char *path, bool is_file, uint64_t *value_r)
+static int get_usage(struct quota_root *root, const char *path, bool is_file, uint64_t *value_r)
{
struct stat st;
@@ -109,7 +115,7 @@
}
*value_r += st.st_size;
} else {
- if (get_dir_usage(path, value_r) < 0)
+ if (get_dir_usage(root, path, value_r) < 0)
return -1;
}
return 0;
@@ -154,6 +160,7 @@
unsigned int i, count;
const char *path;
bool is_file;
+ struct quota_rule *rule;
t_array_init(&paths, 8);
storages = array_get(&root->quota->storages, &count);
@@ -162,6 +169,11 @@
quota_count_path_add(&paths, path, FALSE);
/* INBOX may be in different path. */
+ /* ...but still ignored */
+ rule = quota_root_rule_find(root, "INBOX");
+ if (rule != NULL && rule->ignore)
+ continue;
+
path = mail_storage_get_mailbox_path(storages[i], "INBOX",
&is_file);
quota_count_path_add(&paths, path, is_file);
@@ -171,7 +183,7 @@
*value_r = 0;
count_paths = array_get(&paths, &count);
for (i = 0; i < count; i++) {
- if (get_usage(count_paths[i].path, count_paths[i].is_file,
+ if (get_usage(root, count_paths[i].path, count_paths[i].is_file,
value_r) < 0)
return -1;
}
smime.p7s
Description: S/MIME Cryptographic Signature
