Mercurial > dovecot > core-2.2
changeset 9564:279af9682cd6 HEAD
lib-storage: Added mailbox_get_vname().
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 07 Jul 2009 14:41:35 -0400 |
parents | 1cf278c2fd63 |
children | eda6f7c67058 |
files | src/lib-storage/index/index-storage.c src/lib-storage/mail-storage-private.h src/lib-storage/mail-storage.c src/lib-storage/mail-storage.h |
diffstat | 4 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ const char *path; gid_t dir_gid; const char *origin, *dir_origin; + string_t *vname; - if (name != NULL) + 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) {
--- 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 @@ /* 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;
--- 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 @@ 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);
--- 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 @@ /* 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);