# HG changeset patch # User Timo Sirainen # Date 1176832848 -10800 # Node ID 1fd9616157e400e02963227013d0738da5f601d7 # Parent 36ebd0fe2076111e96f670d7cb7765b5518d1c37 Updated to support namespaces diff -r 36ebd0fe2076 -r 1fd9616157e4 src/plugins/expire/expire-plugin.c --- a/src/plugins/expire/expire-plugin.c Tue Apr 17 20:59:49 2007 +0300 +++ b/src/plugins/expire/expire-plugin.c Tue Apr 17 21:00:48 2007 +0300 @@ -4,6 +4,7 @@ #include "ioloop.h" #include "array.h" #include "dict.h" +#include "mail-namespace.h" #include "index-mail.h" #include "index-storage.h" #include "expire-env.h" @@ -284,10 +285,12 @@ EXPIRE_CONTEXT(storage); struct mailbox *box; const struct expire_box *expire_box; + const char *full_name; box = xpr_storage->super.mailbox_open(storage, name, input, flags); if (box != NULL) { - expire_box = expire_box_find(expire.env, name); + full_name = t_strconcat(storage->ns->prefix, name, NULL); + expire_box = expire_box_find(expire.env, full_name); if (expire_box != NULL) mailbox_expire_hook(box, expire_box->expire_secs); } diff -r 36ebd0fe2076 -r 1fd9616157e4 src/plugins/trash/trash-plugin.c --- a/src/plugins/trash/trash-plugin.c Tue Apr 17 20:59:49 2007 +0300 +++ b/src/plugins/trash/trash-plugin.c Tue Apr 17 21:00:48 2007 +0300 @@ -4,6 +4,7 @@ #include "array.h" #include "istream.h" #include "home-expand.h" +#include "mail-namespace.h" #include "mail-search.h" #include "quota-private.h" #include "quota-plugin.h" @@ -94,6 +95,21 @@ return 1; } +static void trash_find_storage(struct trash_mailbox *trash) +{ + struct mail_storage *const *storages; + unsigned int i, count; + + storages = array_get("a_set->storages, &count); + for (i = 0; i < count; i++) { + if (mail_namespace_update_name(storages[i]->ns, &trash->name)) { + trash->storage = storages[i]; + return; + } + } + i_fatal("trash: Namespace not found for mailbox '%s'", trash->name); +} + static int trash_try_clean_mails(struct quota_transaction_context *ctx, uint64_t size_needed) { @@ -113,15 +129,8 @@ if (trashes[j].priority != trashes[i].priority) break; - if (trashes[j].storage == NULL) { - /* FIXME: this is really ugly. it'll do however - until we get proper namespace support for - lib-storage. */ - struct mail_storage *const *storage; - - storage = array_idx("a_set->storages, 0); - trashes[j].storage = *storage; - } + if (trashes[j].storage == NULL) + trash_find_storage(&trashes[j]); ret = trash_clean_mailbox_get_next(&trashes[j], &received);