[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-storage.c,1.30,1.31

cras at procontrol.fi cras at procontrol.fi
Sun Feb 23 23:06:59 EET 2003


Update of /home/cvs/dovecot/src/lib-storage/index/maildir
In directory danu:/tmp/cvs-serv1249/src/lib-storage/index/maildir

Modified Files:
	maildir-storage.c 
Log Message:
Index opening rewrites. We don't try to support .imap.index-<hostname> style
indexes anymore. They just made things more difficult, and it's really not a
good idea to use index files via NFS anyway.

Added support for :INDEX=MEMORY in MAIL env to disable using index files.
Also if we can't open or create index file for any reason, we now fallback
to in-memory indexes. Before we fallbacked only with out of disk space
errors.

If .customflags can't be created, we still work now by not allowing to
create new custom flags.



Index: maildir-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- maildir-storage.c	20 Feb 2003 10:52:11 -0000	1.30
+++ maildir-storage.c	23 Feb 2003 21:06:57 -0000	1.31
@@ -65,6 +65,8 @@
 
 	if (index_dir == NULL)
 		index_dir = root_dir;
+	else if (strcmp(index_dir, "MEMORY") == 0)
+		index_dir = NULL;
 
 	storage = i_new(struct mail_storage, 1);
 	memcpy(storage, &maildir_storage, sizeof(struct mail_storage));
@@ -90,6 +92,8 @@
 {
 	struct stat st;
 
+	data = t_strcut(data, ':');
+
 	return stat(t_strconcat(data, "/cur", NULL), &st) == 0 &&
 		S_ISDIR(st.st_mode);
 }
@@ -134,6 +138,9 @@
 static const char *maildir_get_index_path(struct mail_storage *storage,
 					  const char *name)
 {
+	if (storage->index_dir == NULL)
+		return NULL;
+
 	if (full_filesystem_access && (*name == '/' || *name == '~'))
 		return maildir_get_absolute_path(name);
 
@@ -209,6 +216,7 @@
 	index = index_storage_lookup_ref(index_dir);
 	if (index == NULL) {
 		index = maildir_index_alloc(index_dir, path);
+		index->custom_flags_dir = i_strdup(path);
 		index_storage_add(index);
 	}
 




More information about the dovecot-cvs mailing list