changeset 3510:2910fde2725d HEAD

Updated behavior of tb-extra-mailbox-sep
author Timo Sirainen <tss@iki.fi>
date Fri, 22 Jul 2005 20:50:15 +0300
parents 5cec18e2ddd1
children d6d8cdd9b0fa
files dovecot-example.conf src/imap/cmd-subscribe.c
diffstat 2 files changed, 11 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dovecot-example.conf	Fri Jul 22 20:09:42 2005 +0300
+++ b/dovecot-example.conf	Fri Jul 22 20:50:15 2005 +0300
@@ -431,11 +431,8 @@
   #     commands. Note that RFC says this shouldn't be done.
   #   tb-extra-mailbox-sep:
   #     With mbox storage a mailbox can contain either mails or submailboxes,
-  #     but not both. Submailboxes-only-mailbox is created by CREATE box/
-  #     command. Thunderbird unfortunately keeps the extra slash also for
-  #     SUBSCRIBE, UNSUBSCRIBE and DELETE commands, causing Dovecot to fail
-  #     with "Invalid mailbox name" error. This workaround strips away the
-  #     extra slash.
+  #     but not both. Thunderbird separates these two by forcing server to
+  #     accept '/' suffix in mailbox names in subscriptions list.
   #imap_client_workarounds = outlook-idle
 }
   
--- a/src/imap/cmd-subscribe.c	Fri Jul 22 20:09:42 2005 +0300
+++ b/src/imap/cmd-subscribe.c	Fri Jul 22 20:50:15 2005 +0300
@@ -6,25 +6,26 @@
 int _cmd_subscribe_full(struct client_command_context *cmd, int subscribe)
 {
         struct mail_storage *storage;
-	const char *mailbox;
+	const char *mailbox, *verify_name;
 
 	/* <mailbox> */
 	if (!client_read_string_args(cmd, 1, &mailbox))
 		return FALSE;
 
-	if ((client_workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0) {
+	verify_name = mailbox;
+	if ((client_workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0 &&
+	    *mailbox != '\0') {
+		/* verify the validity without the trailing '/' */
 		storage = client_find_storage(cmd, &mailbox);
 		if (storage == NULL)
 			return TRUE;
 
-		if (*mailbox != '\0' && mailbox[strlen(mailbox)-1] ==
-		    mail_storage_get_hierarchy_sep(storage)) {
-			/* drop the extra trailing hierarchy separator */
-			mailbox = t_strndup(mailbox, strlen(mailbox)-1);
-		}
+		if (mailbox[strlen(mailbox)-1] ==
+		    mail_storage_get_hierarchy_sep(storage))
+			verify_name = t_strndup(mailbox, strlen(mailbox)-1);
 	}
 
-	if (!client_verify_mailbox_name(cmd, mailbox, subscribe, FALSE))
+	if (!client_verify_mailbox_name(cmd, verify_name, subscribe, FALSE))
 		return TRUE;
 
 	storage = client_find_storage(cmd, &mailbox);