Mercurial > dovecot > original-hg > dovecot-1.2
diff src/plugins/trash/trash-plugin.c @ 8082:db66611fd195 HEAD
Added struct mail_user and fixed the code to support multiple users per process.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 12 Aug 2008 12:28:42 -0400 |
parents | 077bb84e9e77 |
children | b2a258213ee0 |
line wrap: on
line diff
--- a/src/plugins/trash/trash-plugin.c Fri Aug 08 17:16:07 2008 -0400 +++ b/src/plugins/trash/trash-plugin.c Tue Aug 12 12:28:42 2008 -0400 @@ -21,9 +21,9 @@ const char *name; int priority; /* lower number = higher priority */ + /* temporarily set while cleaning: */ + const char *ns_name; struct mail_storage *storage; - - /* temporarily set while cleaning: */ struct mailbox *box; struct mailbox_transaction_context *trans; struct mail_search_context *search_ctx; @@ -45,7 +45,7 @@ { struct mail_search_args *search_args; - trash->box = mailbox_open(trash->storage, trash->name, NULL, + trash->box = mailbox_open(trash->storage, trash->ns_name, NULL, MAILBOX_OPEN_KEEP_RECENT); if (trash->box == NULL) return 0; @@ -89,14 +89,17 @@ return 1; } -static void trash_find_storage(struct trash_mailbox *trash) +static void trash_find_storage(struct quota *quota, + struct trash_mailbox *trash) { struct mail_storage *const *storages; unsigned int i, count; - storages = array_get("a_set->storages, &count); + storages = array_get("a->storages, &count); for (i = 0; i < count; i++) { - if (mail_namespace_update_name(storages[i]->ns, &trash->name)) { + trash->ns_name = trash->name; + if (mail_namespace_update_name(storages[i]->ns, + &trash->ns_name)) { trash->storage = storages[i]; return; } @@ -124,7 +127,7 @@ break; if (trashes[j].storage == NULL) - trash_find_storage(&trashes[j]); + trash_find_storage(ctx->quota, &trashes[j]); ret = trash_clean_mailbox_get_next(&trashes[j], &received); @@ -177,6 +180,8 @@ } mailbox_close(&trash->box); + trash->storage = NULL; + trash->ns_name = NULL; } if (size_expunged < size_needed) {