dovecot-2.0: lib-storage: Added mailbox_get_vname().

dovecot at dovecot.org dovecot at dovecot.org
Tue Jul 7 21:46:57 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/279af9682cd6
changeset: 9564:279af9682cd6
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jul 07 14:41:35 2009 -0400
description:
lib-storage: Added mailbox_get_vname().

diffstat:

4 files changed, 19 insertions(+), 3 deletions(-)
src/lib-storage/index/index-storage.c  |   12 +++++++++---
src/lib-storage/mail-storage-private.h |    2 ++
src/lib-storage/mail-storage.c         |    5 +++++
src/lib-storage/mail-storage.h         |    3 +++

diffs (65 lines):

diff -r 1cf278c2fd63 -r 279af9682cd6 src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c	Tue Jul 07 14:19:05 2009 -0400
+++ b/src/lib-storage/index/index-storage.c	Tue Jul 07 14:41:35 2009 -0400
@@ -453,12 +453,18 @@ void index_storage_mailbox_alloc(struct 
 	const char *path;
 	gid_t dir_gid;
 	const char *origin, *dir_origin;
-
-	if (name != NULL)
+	string_t *vname;
+
+	if (name != NULL) {
 		box->name = p_strdup(box->pool, name);
-	else {
+		vname = t_str_new(128);
+		mail_namespace_get_vname(box->storage->user->namespaces,
+					 vname, name);
+		box->vname = p_strdup(box->pool, str_c(vname));
+	} else {
 		i_assert(input != NULL);
 		box->name = "(read-only input stream)";
+		box->vname = box->name;
 	}
 
 	if (input != NULL) {
diff -r 1cf278c2fd63 -r 279af9682cd6 src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h	Tue Jul 07 14:19:05 2009 -0400
+++ b/src/lib-storage/mail-storage-private.h	Tue Jul 07 14:41:35 2009 -0400
@@ -224,6 +224,8 @@ struct mailbox {
 
 	/* mailbox's MAILBOX_LIST_PATH_TYPE_MAILBOX */
 	const char *path;
+	/* mailbox's virtual name (from mail_namespace_get_vname()) */
+	const char *vname;
 	struct istream *input;
 	enum mailbox_flags flags;
 	unsigned int transaction_count;
diff -r 1cf278c2fd63 -r 279af9682cd6 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Tue Jul 07 14:19:05 2009 -0400
+++ b/src/lib-storage/mail-storage.c	Tue Jul 07 14:41:35 2009 -0400
@@ -565,6 +565,11 @@ const char *mailbox_get_name(const struc
 	return box->name;
 }
 
+const char *mailbox_get_vname(const struct mailbox *box)
+{
+	return box->vname;
+}
+
 bool mailbox_is_readonly(struct mailbox *box)
 {
 	return box->v.is_readonly(box);
diff -r 1cf278c2fd63 -r 279af9682cd6 src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h	Tue Jul 07 14:19:05 2009 -0400
+++ b/src/lib-storage/mail-storage.h	Tue Jul 07 14:41:35 2009 -0400
@@ -332,6 +332,9 @@ mailbox_get_settings(struct mailbox *box
 
 /* Returns name of given mailbox */
 const char *mailbox_get_name(const struct mailbox *box) ATTR_PURE;
+/* Returns the virtual name of the given mailbox. This is the same as using
+   mail_namespace_get_vname(). */
+const char *mailbox_get_vname(const struct mailbox *box) ATTR_PURE;
 
 /* Returns TRUE if mailbox is read-only. */
 bool mailbox_is_readonly(struct mailbox *box);


More information about the dovecot-cvs mailing list