[dovecot-cvs] dovecot/src/imap namespace.c,1.5,1.6

cras at dovecot.org cras at dovecot.org
Wed Dec 29 21:10:28 EET 2004


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv29231/src/imap

Modified Files:
	namespace.c 
Log Message:
Added mail_debug setting. Moved full_filesystem_access from global variable
to flag in mail_create*() functions.



Index: namespace.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/namespace.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- namespace.c	22 Jul 2004 21:20:00 -0000	1.5
+++ namespace.c	29 Dec 2004 19:10:26 -0000	1.6
@@ -27,7 +27,7 @@
 
 static struct namespace *
 namespace_add_env(pool_t pool, const char *data, unsigned int num,
-		  const char *user)
+		  const char *user, enum mail_storage_flags flags)
 {
         struct namespace *ns;
         const char *sep, *type, *prefix;
@@ -55,11 +55,20 @@
 	if (prefix == NULL)
 		prefix = "";
 
+	if ((flags & MAIL_STORAGE_FLAG_DEBUG) != 0) {
+		i_info("Namespace: type=%s, prefix=%s, sep=%s, "
+		       "inbox=%s, hidden=%s, subscriptions=%s",
+		       type == NULL ? "" : type, prefix, sep == NULL ? "" : sep,
+		       inbox ? "yes" : "no",
+		       hidden ? "yes" : "no",
+		       subscriptions ? "yes" : "no");
+	}
+
 	ns->prefix = p_strdup(pool, prefix);
 	ns->inbox = inbox;
 	ns->hidden = hidden;
 	ns->subscriptions = subscriptions;
-	ns->storage = mail_storage_create_with_data(data, user);
+	ns->storage = mail_storage_create_with_data(data, user, flags);
 	if (ns->storage == NULL) {
 		i_fatal("Failed to create storage for '%s' with data: %s",
 			ns->prefix, data);
@@ -74,9 +83,16 @@
 struct namespace *namespace_init(pool_t pool, const char *user)
 {
 	struct namespace *namespaces, *ns, **ns_p;
+        enum mail_storage_flags flags;
 	const char *mail, *data;
 	unsigned int i;
 
+	flags = 0;
+	if (getenv("FULL_FILESYSTEM_ACCESS") != NULL)
+		flags |= MAIL_STORAGE_FLAG_FULL_FS_ACCESS;
+	if (getenv("DEBUG") != NULL)
+		flags |= MAIL_STORAGE_FLAG_DEBUG;
+
         namespaces = NULL; ns_p = &namespaces;
 
 	/* first try NAMESPACE_* environments */
@@ -89,7 +105,7 @@
 			break;
 
 		t_push();
-		*ns_p = namespace_add_env(pool, data, i, user);
+		*ns_p = namespace_add_env(pool, data, i, user, flags);
 		t_pop();
 
 		ns_p = &(*ns_p)->next;
@@ -108,7 +124,7 @@
 	}
 
 	ns = p_new(pool, struct namespace, 1);
-	ns->storage = mail_storage_create_with_data(mail, user);
+	ns->storage = mail_storage_create_with_data(mail, user, flags);
 	if (ns->storage == NULL) {
 		if (mail != NULL && *mail != '\0')
 			i_fatal("Failed to create storage with data: %s", mail);



More information about the dovecot-cvs mailing list