From: Timo Sirainen Date: Fri, 21 Nov 2008 17:56:42 +0000 (+0200) Subject: Expire plugin works now with multiple struct mail_users. X-Git-Tag: 1.2.alpha4~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=783278c012551bc2f25f065a8d3ec1a3cfc0d296;p=thirdparty%2Fdovecot%2Fcore.git Expire plugin works now with multiple struct mail_users. --HG-- branch : HEAD --- diff --git a/src/plugins/expire/expire-plugin.c b/src/plugins/expire/expire-plugin.c index 942dfe0d8a..2ae978d68e 100644 --- a/src/plugins/expire/expire-plugin.c +++ b/src/plugins/expire/expire-plugin.c @@ -21,7 +21,6 @@ struct expire { struct dict *db; struct expire_env *env; - const char *username; void (*next_hook_mail_storage_created)(struct mail_storage *storage); }; @@ -124,7 +123,8 @@ expire_mailbox_transaction_commit(struct mailbox_transaction_context *t, if (xt->first_expunged || xt->saves) T_BEGIN { const char *key, *value; - key = t_strconcat(DICT_EXPIRE_PREFIX, expire.username, "/", + key = t_strconcat(DICT_EXPIRE_PREFIX, + box->storage->ns->user->username, "/", box->storage->ns->prefix, box->name, NULL); if (!xt->first_expunged && xt->saves) { /* saved new mails. dict needs to be updated only if @@ -296,10 +296,10 @@ void expire_plugin_init(void) if (dict_uri == NULL) i_fatal("expire plugin: expire_dict setting missing"); - // FIXME: user should be per-mail_user?... - expire.username = getenv("USER"); expire.env = expire_env_init(expunge_env, altmove_env); - expire.db = dict_init(dict_uri, DICT_DATA_TYPE_UINT32, expire.username); + /* we're using only shared dictionary, the username + doesn't matter. */ + expire.db = dict_init(dict_uri, DICT_DATA_TYPE_UINT32, ""); if (expire.db == NULL) i_fatal("expire plugin: dict_init() failed");