Mercurial > dovecot > core-2.2
changeset 1750:4e14ba3c115b HEAD
Added "inbox" setting to specify which namespace has the INBOX.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 06 Sep 2003 20:44:51 +0300 |
parents | 9ce1e589d3c1 |
children | fd33cf8a1261 |
files | src/imap/namespace.c src/imap/namespace.h src/master/mail-process.c src/master/master-settings.c src/master/master-settings.h |
diffstat | 5 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/namespace.c Sat Sep 06 20:37:10 2003 +0300 +++ b/src/imap/namespace.c Sat Sep 06 20:44:51 2003 +0300 @@ -12,12 +12,14 @@ { 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 @@ 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 @@ } 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 @@ 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 :
--- a/src/imap/namespace.h Sat Sep 06 20:37:10 2003 +0300 +++ b/src/imap/namespace.h Sat Sep 06 20:44:51 2003 +0300 @@ -13,6 +13,7 @@ enum namespace_type type; char hierarchy_sep; char *prefix; + int inbox; struct mail_storage *storage; };
--- a/src/master/mail-process.c Sat Sep 06 20:37:10 2003 +0300 +++ b/src/master/mail-process.c Sat Sep 06 20:44:51 2003 +0300 @@ -133,6 +133,8 @@ 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(); } }