dovecot-2.0: plugins: Changed to use the new client_find_namespa...

dovecot at dovecot.org dovecot at dovecot.org
Tue Mar 16 16:20:31 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/05e93cd2cb86
changeset: 10919:05e93cd2cb86
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Mar 16 16:20:28 2010 +0200
description:
plugins: Changed to use the new client_find_namespace() API.

diffstat:

 src/plugins/imap-acl/imap-acl-plugin.c     |  15 +++++++--------
 src/plugins/imap-quota/imap-quota-plugin.c |   9 ++++-----
 2 files changed, 11 insertions(+), 13 deletions(-)

diffs (98 lines):

diff -r 7443f0b5218f -r 05e93cd2cb86 src/plugins/imap-acl/imap-acl-plugin.c
--- a/src/plugins/imap-acl/imap-acl-plugin.c	Tue Mar 16 16:15:03 2010 +0200
+++ b/src/plugins/imap-acl/imap-acl-plugin.c	Tue Mar 16 16:20:28 2010 +0200
@@ -57,6 +57,7 @@
 {
 	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 @@
 		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 @@
 {
 	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 @@
 		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 @@
 	    (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 -r 7443f0b5218f -r 05e93cd2cb86 src/plugins/imap-quota/imap-quota-plugin.c
--- a/src/plugins/imap-quota/imap-quota-plugin.c	Tue Mar 16 16:15:03 2010 +0200
+++ b/src/plugins/imap-quota/imap-quota-plugin.c	Tue Mar 16 16:20:28 2010 +0200
@@ -74,15 +74,14 @@
 	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;
 
 	/* <mailbox> */
 	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 @@
 		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) {


More information about the dovecot-cvs mailing list