diff -ruN dovecot-1.0-stable.orig/src/imap/cmd-list.c dovecot-1.0-stable/src/imap/cmd-list.c
--- dovecot-1.0-stable.orig/src/imap/cmd-list.c	Fri Mar 18 20:00:44 2005
+++ dovecot-1.0-stable/src/imap/cmd-list.c	Wed Jul 20 16:36:51 2005
@@ -293,6 +293,8 @@
 	list_flags = ctx->list_flags;
 	if (*ns->prefix == '\0' || ns->inbox)
 		list_flags |= MAILBOX_LIST_INBOX;
+        if (ns->showdotfiles)
+		list_flags |= MAILBOX_LIST_DOTFILES;
 	ctx->list_ctx = mail_storage_mailbox_list_init(ns->storage,
 						       cur_ref, cur_mask,
 						       list_flags);
diff -ruN dovecot-1.0-stable.orig/src/imap/namespace.c dovecot-1.0-stable/src/imap/namespace.c
--- dovecot-1.0-stable.orig/src/imap/namespace.c	Mon Jan 31 16:37:54 2005
+++ dovecot-1.0-stable/src/imap/namespace.c	Wed Jul 20 16:36:51 2005
@@ -31,7 +31,7 @@
 {
         struct namespace *ns;
         const char *sep, *type, *prefix;
-	int inbox, hidden, subscriptions;
+	int inbox, hidden, showdotfiles, subscriptions;
 
 	ns = p_new(pool, struct namespace, 1);
 
@@ -40,6 +40,7 @@
 	prefix = getenv(t_strdup_printf("NAMESPACE_%u_PREFIX", num));
 	inbox = getenv(t_strdup_printf("NAMESPACE_%u_INBOX", num)) != NULL;
 	hidden = getenv(t_strdup_printf("NAMESPACE_%u_HIDDEN", num)) != NULL;
+	showdotfiles = getenv(t_strdup_printf("NAMESPACE_%u_SHOWDOTFILES", num)) != NULL;
 	subscriptions = getenv(t_strdup_printf("NAMESPACE_%u_SUBSCRIPTIONS",
 					       num)) != NULL;
 
@@ -58,6 +59,7 @@
 	ns->prefix = p_strdup(pool, prefix);
 	ns->inbox = inbox;
 	ns->hidden = hidden;
+	ns->showdotfiles = showdotfiles;
 	ns->subscriptions = subscriptions;
 	ns->storage = mail_storage_create_with_data(data, user);
 	if (ns->storage == NULL) {
diff -ruN dovecot-1.0-stable.orig/src/imap/namespace.h dovecot-1.0-stable/src/imap/namespace.h
--- dovecot-1.0-stable.orig/src/imap/namespace.h	Mon Jan 31 16:37:54 2005
+++ dovecot-1.0-stable/src/imap/namespace.h	Wed Jul 20 16:36:51 2005
@@ -16,7 +16,7 @@
 	char *prefix;
 	size_t prefix_len;
 
-	int inbox, hidden, subscriptions;
+	int inbox, hidden, showdotfiles, subscriptions;
 	struct mail_storage *storage;
 };
 
diff -ruN dovecot-1.0-stable.orig/src/lib-storage/index/mbox/mbox-list.c dovecot-1.0-stable/src/lib-storage/index/mbox/mbox-list.c
--- dovecot-1.0-stable.orig/src/lib-storage/index/mbox/mbox-list.c	Mon Jan 31 16:37:55 2005
+++ dovecot-1.0-stable/src/lib-storage/index/mbox/mbox-list.c	Wed Jul 20 16:36:51 2005
@@ -225,13 +225,19 @@
 	enum imap_match_result match, match2;
 	int ret, noselect;
 
-	/* skip all hidden files */
-	if (fname[0] == '.')
+	/* skip all hidden files unless show dotfiles is set*/
+	if (fname[0] == '.' && !(ctx->flags & MAILBOX_LIST_DOTFILES))
 		return 0;
 
 	/* skip all .lock files */
 	len = strlen(fname);
 	if (len > 5 && strcmp(fname+len-5, ".lock") == 0)
+		return 0;
+
+        /* skip ".imap" "." and ".." directories in case we show dotfiles */
+        if (((len == 5) && strcmp(fname, ".imap") == 0) ||
+	    ((len == 1) && fname[0] == '.') ||
+	    ((len == 2) && strcmp(fname, "..") == 0)) 
 		return 0;
 
 	/* check the mask */
diff -ruN dovecot-1.0-stable.orig/src/lib-storage/mail-storage.h dovecot-1.0-stable/src/lib-storage/mail-storage.h
--- dovecot-1.0-stable.orig/src/lib-storage/mail-storage.h	Mon Jan 31 16:37:55 2005
+++ dovecot-1.0-stable/src/lib-storage/mail-storage.h	Wed Jul 20 16:36:51 2005
@@ -16,7 +16,8 @@
 	MAILBOX_LIST_SUBSCRIBED	= 0x01,
 	MAILBOX_LIST_FAST_FLAGS	= 0x02,
 	MAILBOX_LIST_CHILDREN	= 0x04,
-	MAILBOX_LIST_INBOX	= 0x04
+	MAILBOX_LIST_INBOX	= 0x04,
+	MAILBOX_LIST_DOTFILES	= 0x08
 };
 
 enum mailbox_flags {
diff -ruN dovecot-1.0-stable.orig/src/master/mail-process.c dovecot-1.0-stable/src/master/mail-process.c
--- dovecot-1.0-stable.orig/src/master/mail-process.c	Tue Feb  8 10:30:11 2005
+++ dovecot-1.0-stable/src/master/mail-process.c	Wed Jul 20 16:36:51 2005
@@ -175,6 +175,8 @@
 			env_put(t_strdup_printf("NAMESPACE_%u_INBOX=1", i));
 		if (ns->hidden)
 			env_put(t_strdup_printf("NAMESPACE_%u_HIDDEN=1", i));
+		if (ns->showdotfiles)
+			env_put(t_strdup_printf("NAMESPACE_%u_SHOWDOTFILES=1", i));
 		t_pop();
 	}
 }
diff -ruN dovecot-1.0-stable.orig/src/master/master-settings.c dovecot-1.0-stable/src/master/master-settings.c
--- dovecot-1.0-stable.orig/src/master/master-settings.c	Mon Jan 31 16:37:55 2005
+++ dovecot-1.0-stable/src/master/master-settings.c	Wed Jul 20 16:36:51 2005
@@ -194,6 +194,7 @@
 	DEF(SET_STR, location),
 	DEF(SET_BOOL, inbox),
 	DEF(SET_BOOL, hidden),
+	DEF(SET_BOOL, showdotfiles),
 
 	{ 0, NULL, 0 }
 };
diff -ruN dovecot-1.0-stable.orig/src/master/master-settings.h dovecot-1.0-stable/src/master/master-settings.h
--- dovecot-1.0-stable.orig/src/master/master-settings.h	Mon Jan 31 16:37:55 2005
+++ dovecot-1.0-stable/src/master/master-settings.h	Wed Jul 20 16:36:51 2005
@@ -163,6 +163,7 @@
 
 	int inbox;
 	int hidden;
+	int showdotfiles;
 };
 
 struct server_settings {
