]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added "inbox" setting to specify which namespace has the INBOX.
authorTimo Sirainen <tss@iki.fi>
Sat, 6 Sep 2003 17:44:51 +0000 (20:44 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 6 Sep 2003 17:44:51 +0000 (20:44 +0300)
--HG--
branch : HEAD

src/imap/namespace.c
src/imap/namespace.h
src/master/mail-process.c
src/master/master-settings.c
src/master/master-settings.h

index 97b1ea5bcb1d09714ba87925b22a8aa79d30d09c..16818c1422340e256c2a2c8ab4095d23ae84c520 100644 (file)
@@ -12,12 +12,14 @@ namespace_add_env(pool_t pool, const char *data, unsigned int num,
 {
         struct namespace *ns;
         const char *sep, *type, *prefix;
+       int inbox;
 
        ns = p_new(pool, struct namespace, 1);
 
        sep = getenv(t_strdup_printf("NAMESPACE_%u_SEP", num));
        type = getenv(t_strdup_printf("NAMESPACE_%u_TYPE", num));
        prefix = getenv(t_strdup_printf("NAMESPACE_%u_PREFIX", num));
+       inbox = getenv(t_strdup_printf("NAMESPACE_%u_INBOX", num)) != NULL;
 
        if (type == NULL || *type == '\0' || strncmp(type, "private", 7) == 0)
                ns->type = NAMESPACE_PRIVATE;
@@ -32,6 +34,7 @@ namespace_add_env(pool_t pool, const char *data, unsigned int num,
                prefix = "";
 
        ns->prefix = p_strdup(pool, prefix);
+       ns->inbox = inbox;
        ns->storage = mail_storage_create_with_data(data, user, ns->prefix,
                                                    sep != NULL ? *sep : '\0');
        if (ns->storage == NULL) {
@@ -99,6 +102,7 @@ struct namespace *namespace_init(pool_t pool, const char *user)
        }
 
        ns->type = NAMESPACE_PRIVATE;
+       ns->inbox = TRUE;
        ns->prefix = p_strdup(pool, "");
        ns->hierarchy_sep = ns->storage->hierarchy_sep;
        if (hook_mail_storage_created != NULL)
@@ -123,6 +127,17 @@ namespace_find(struct namespace *namespaces, const char *mailbox)
        int inbox;
 
        inbox = strncasecmp(mailbox, "INBOX", 5) == 0;
+       if (inbox && mailbox[5] == '\0') {
+               /* find the INBOX namespace */
+               while (namespaces != NULL) {
+                       if (namespaces->inbox)
+                               return namespaces;
+                       if (namespaces->prefix == NULL)
+                               best = namespaces;
+                       namespaces = namespaces->next;
+               }
+               return best;
+       }
 
        while (namespaces != NULL) {
                len = namespaces->prefix == NULL ? 0 :
index 16dcf0a5962c5ec5dd88a24637115fd0da0fb6a9..d70b7ac024cd1a190ccc4ae5d474c3a56e6a0035 100644 (file)
@@ -13,6 +13,7 @@ struct namespace {
         enum namespace_type type;
        char hierarchy_sep;
        char *prefix;
+       int inbox;
        struct mail_storage *storage;
 };
 
index fb954fb243f88e9a6ccbf3daaba26b563f47959a..47382187496750036ccf40ac1cfe0f7da969f22b 100644 (file)
@@ -133,6 +133,8 @@ static void env_put_namespace(struct namespace_settings *ns,
                        env_put(t_strdup_printf("NAMESPACE_%u_PREFIX=%s",
                                                i, ns->prefix));
                }
+               if (ns->inbox)
+                       env_put(t_strdup_printf("NAMESPACE_%u_INBOX=1", i));
                t_pop();
        }
 }
index 5db71ea804066f52c3a8a6189c3d9a2d3cacdce4..958a74f1aaa1f9bbe4a542e181883761e23f87e2 100644 (file)
@@ -142,6 +142,7 @@ static struct setting_def namespace_setting_defs[] = {
        DEF(SET_STR, separator),
        DEF(SET_STR, prefix),
        DEF(SET_STR, location),
+       DEF(SET_BOOL, inbox),
 
        { 0, NULL, 0 }
 };
index 8fea5ba14b91a35c0acb329ec717ed11cfc88ba0..2edd90352ea1f4360a3a7348a79727e0ebd115d5 100644 (file)
@@ -120,6 +120,8 @@ struct namespace_settings {
        const char *separator;
        const char *prefix;
        const char *location;
+
+       int inbox;
 };
 
 struct server_settings {