]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Added mailbox_get_vname().
authorTimo Sirainen <tss@iki.fi>
Tue, 7 Jul 2009 18:41:35 +0000 (14:41 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 7 Jul 2009 18:41:35 +0000 (14:41 -0400)
--HG--
branch : HEAD

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

index 20784e66b8ac19d205ffae33ee3813a11fd69dab..f9585b1284546ab47d99cc6bc29a1da9cdaf79e7 100644 (file)
@@ -453,12 +453,18 @@ void index_storage_mailbox_alloc(struct index_mailbox *ibox, const char *name,
        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) {
index 518925fd0eb42bc6f6e53de3ea8c5c152c6cbb96..424df38bcd907ca1444030384e3e34d1cc16b852 100644 (file)
@@ -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;
index 3c09803015439be4e88cf92b78bfd42573ed34b4..172722ca9b6946a9455e557683733ff18400cfcb 100644 (file)
@@ -565,6 +565,11 @@ const char *mailbox_get_name(const struct mailbox *box)
        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);
index 14a5382a00f715c3a9f3b1e85661039b1e59fc0b..af2080aa76d5c1b1f6f0797386267af6e368e703 100644 (file)
@@ -332,6 +332,9 @@ mailbox_get_settings(struct mailbox *box) ATTR_PURE;
 
 /* 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);