[dovecot-cvs] dovecot/src/imap namespace.c,1.1,1.2 namespace.h,1.1,1.2

cras at procontrol.fi cras at procontrol.fi
Sat Sep 6 21:44:53 EEST 2003


Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv22280/imap

Modified Files:
	namespace.c namespace.h 
Log Message:
Added "inbox" setting to specify which namespace has the INBOX.



Index: namespace.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/namespace.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- namespace.c	27 Jul 2003 04:48:32 -0000	1.1
+++ namespace.c	6 Sep 2003 17:44:51 -0000	1.2
@@ -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 :

Index: namespace.h
===================================================================
RCS file: /home/cvs/dovecot/src/imap/namespace.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- namespace.h	27 Jul 2003 04:48:32 -0000	1.1
+++ namespace.h	6 Sep 2003 17:44:51 -0000	1.2
@@ -13,6 +13,7 @@
         enum namespace_type type;
 	char hierarchy_sep;
 	char *prefix;
+	int inbox;
 	struct mail_storage *storage;
 };
 



More information about the dovecot-cvs mailing list