Mercurial > dovecot > original-hg > dovecot-1.1
changeset 8343:0596612675b5 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 | 9954461eda42 |
children | d3246f9fbfcf |
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 Fri Aug 07 14:44:58 2009 -0400 +++ b/src/imap/cmd-subscribe.c Thu Aug 13 20:45:09 2009 -0400 @@ -28,7 +28,8 @@ bool cmd_subscribe_full(struct client_command_context *cmd, bool subscribe) { struct mail_namespace *ns; - const char *mailbox, *verify_name; + const char *mailbox, *mailbox2 = NULL, *verify_name; + bool unsubscribed_mailbox2; /* <mailbox> */ if (!client_read_string_args(cmd, 1, &mailbox)) @@ -47,6 +48,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->namespaces, @@ -58,9 +61,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.");