Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9321:339be408f49a HEAD
tb-extra-mailbox-sep workaround works better now.
Mailbox is subscribed without trailing separator. Unsubscribe tries to
remove both with and without separator.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 13 Aug 2009 20:45:09 -0400 |
parents | 0463fc241aae |
children | 8ca1f9f1ef2e |
files | src/imap/cmd-subscribe.c |
diffstat | 1 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/cmd-subscribe.c Thu Aug 13 20:21:21 2009 -0400 +++ b/src/imap/cmd-subscribe.c Thu Aug 13 20:45:09 2009 -0400 @@ -30,7 +30,8 @@ { struct mail_namespace *ns, *real_ns; struct mail_storage *storage; - const char *mailbox, *verify_name, *real_name; + const char *mailbox, *mailbox2 = NULL, *verify_name, *real_name; + bool unsubscribed_mailbox2; /* <mailbox> */ if (!client_read_string_args(cmd, 1, &mailbox)) @@ -66,6 +67,8 @@ mail_storage_get_hierarchy_sep(ns->storage)) { /* verify the validity without the trailing '/' */ verify_name = t_strndup(verify_name, strlen(verify_name)-1); + mailbox2 = mailbox; + mailbox = t_strndup(mailbox, strlen(mailbox)-1); } if (have_listable_namespace_prefix(cmd->client->user->namespaces, @@ -81,9 +84,17 @@ return TRUE; } - if (mailbox_list_set_subscribed(ns->list, mailbox, subscribe) < 0) + unsubscribed_mailbox2 = FALSE; + if (!subscribe && mailbox2 != NULL) { + /* try to unsubscribe both "box" and "box/" */ + if (mailbox_list_set_subscribed(ns->list, mailbox2, FALSE) == 0) + unsubscribed_mailbox2 = TRUE; + } + + if (mailbox_list_set_subscribed(ns->list, mailbox, subscribe) < 0 && + !unsubscribed_mailbox2) { client_send_list_error(cmd, ns->list); - else { + } else { client_send_tagline(cmd, subscribe ? "OK Subscribe completed." : "OK Unsubscribe completed.");