[dovecot-cvs] dovecot/src/plugins/quota quota.c,1.18,1.19
tss at dovecot.org
tss at dovecot.org
Fri Feb 16 20:22:38 UTC 2007
Update of /var/lib/cvs/dovecot/src/plugins/quota
In directory talvi:/tmp/cvs-serv1358
Modified Files:
quota.c
Log Message:
If we have multiple namespaces with identical locations, add only one
such storage so the quota doesn't get duplicated.
Index: quota.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- quota.c 25 Jan 2007 15:49:48 -0000 1.18
+++ quota.c 16 Feb 2007 20:22:36 -0000 1.19
@@ -248,8 +248,26 @@
void quota_add_user_storage(struct quota *quota, struct mail_storage *storage)
{
struct quota_root *const *roots;
+ struct mail_storage *const *storages;
struct quota_backend **backends;
+ const char *path, *path2;
unsigned int i, j, count;
+ bool is_file;
+
+ /* first check if there already exists a storage with the exact same
+ path. we don't want to count them twice. */
+ path = mail_storage_get_mailbox_path(storage, "", &is_file);
+ if (path != NULL) {
+ storages = array_get("a->storages, &count);
+ for (i = 0; i < count; i++) {
+ path2 = mail_storage_get_mailbox_path(storages[i], "",
+ &is_file);
+ if (path2 != NULL && strcmp(path, path2) == 0) {
+ /* duplicate */
+ return;
+ }
+ }
+ }
array_append("a->storages, &storage, 1);
More information about the dovecot-cvs
mailing list