From: Timo Sirainen Date: Tue, 16 Mar 2010 14:20:28 +0000 (+0200) Subject: plugins: Changed to use the new client_find_namespace() API. X-Git-Tag: 2.0.beta4~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e593e507ee5ea3869271a631874c5c4b5c7a294d;p=thirdparty%2Fdovecot%2Fcore.git plugins: Changed to use the new client_find_namespace() API. --HG-- branch : HEAD --- diff --git a/src/plugins/imap-acl/imap-acl-plugin.c b/src/plugins/imap-acl/imap-acl-plugin.c index 1002d4057d..bf3b51954a 100644 --- a/src/plugins/imap-acl/imap-acl-plugin.c +++ b/src/plugins/imap-acl/imap-acl-plugin.c @@ -57,6 +57,7 @@ acl_mailbox_open_as_admin(struct client_command_context *cmd, const char *name) { struct mail_namespace *ns; struct mailbox *box; + const char *storage_name; int ret; if (ACL_USER_CONTEXT(cmd->client->user) == NULL) { @@ -64,13 +65,13 @@ acl_mailbox_open_as_admin(struct client_command_context *cmd, const char *name) return NULL; } - ns = client_find_namespace(cmd, &name, CLIENT_VERIFY_MAILBOX_NONE); + ns = client_find_namespace(cmd, name, &storage_name, NULL); if (ns == NULL) return NULL; /* Force opening the mailbox so that we can give a nicer error message if mailbox isn't selectable but is listable. */ - box = mailbox_alloc(ns->list, name, ACL_MAILBOX_FLAGS | + box = mailbox_alloc(ns->list, storage_name, ACL_MAILBOX_FLAGS | MAILBOX_FLAG_IGNORE_ACLS); ret = acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_ADMIN); if (ret > 0) @@ -281,7 +282,7 @@ static bool cmd_myrights(struct client_command_context *cmd) { struct mail_namespace *ns; struct mailbox *box; - const char *mailbox, *real_mailbox; + const char *mailbox, *storage_name; const char *const *rights; string_t *str; @@ -293,13 +294,11 @@ static bool cmd_myrights(struct client_command_context *cmd) return TRUE; } - real_mailbox = mailbox; - ns = client_find_namespace(cmd, &real_mailbox, - CLIENT_VERIFY_MAILBOX_NONE); + ns = client_find_namespace(cmd, mailbox, &storage_name, NULL); if (ns == NULL) return TRUE; - box = mailbox_alloc(ns->list, real_mailbox, + box = mailbox_alloc(ns->list, storage_name, ACL_MAILBOX_FLAGS | MAILBOX_FLAG_IGNORE_ACLS); if (acl_object_get_my_rights(acl_mailbox_get_aclobj(box), pool_datastack_create(), &rights) < 0) { @@ -313,7 +312,7 @@ static bool cmd_myrights(struct client_command_context *cmd) (strcmp(*rights, MAIL_ACL_POST) == 0 && rights[1] == NULL)) { client_send_tagline(cmd, t_strdup_printf( "NO ["IMAP_RESP_CODE_NONEXISTENT"] " - MAIL_ERRSTR_MAILBOX_NOT_FOUND, real_mailbox)); + MAIL_ERRSTR_MAILBOX_NOT_FOUND, mailbox)); mailbox_free(&box); return TRUE; } diff --git a/src/plugins/imap-quota/imap-quota-plugin.c b/src/plugins/imap-quota/imap-quota-plugin.c index b2375b457a..6f85c6dd34 100644 --- a/src/plugins/imap-quota/imap-quota-plugin.c +++ b/src/plugins/imap-quota/imap-quota-plugin.c @@ -74,15 +74,14 @@ static bool cmd_getquotaroot(struct client_command_context *cmd) struct mailbox *box; struct quota_root_iter *iter; struct quota_root *root; - const char *orig_mailbox, *mailbox, *name; + const char *mailbox, *storage_name, *name; string_t *str; /* */ if (!client_read_string_args(cmd, 1, &mailbox)) return FALSE; - orig_mailbox = mailbox; - ns = client_find_namespace(cmd, &mailbox, CLIENT_VERIFY_MAILBOX_NONE); + ns = client_find_namespace(cmd, mailbox, &storage_name, NULL); if (ns == NULL) return TRUE; @@ -96,13 +95,13 @@ static bool cmd_getquotaroot(struct client_command_context *cmd) return TRUE; } - box = mailbox_alloc(ns->list, mailbox, MAILBOX_FLAG_READONLY | + box = mailbox_alloc(ns->list, storage_name, MAILBOX_FLAG_READONLY | MAILBOX_FLAG_KEEP_RECENT); /* send QUOTAROOT reply */ str = t_str_new(128); str_append(str, "* QUOTAROOT "); - imap_quote_append_string(str, orig_mailbox, FALSE); + imap_quote_append_string(str, mailbox, FALSE); iter = quota_root_iter_init(box); while ((root = quota_root_iter_next(iter)) != NULL) {