On Mon, 2007-06-18 at 10:59 -0500, [EMAIL PROTECTED] wrote: > Here's our situation: Migrating from UW-IMAP. Have lots (as in, tens of > thousands) of clients set up using '~/mail' as the IMAP root, and using > subscriptions.
See if the attached patch fixes everything. I'll add it to v1.1.
diff -r 7bb0916b17ec src/imap/cmd-list.c
--- a/src/imap/cmd-list.c Wed Jun 27 23:23:06 2007 +0300
+++ b/src/imap/cmd-list.c Wed Jun 27 23:52:52 2007 +0300
@@ -252,6 +252,12 @@ list_namespace_init(struct client_comman
cur_ref = ctx->ref;
cur_mask = ctx->mask;
+ if (ctx->ns->hidden &&
+ (ctx->list_flags & MAILBOX_LIST_SUBSCRIBED) != 0) {
+ /* ignore hidden namespaces */
+ return;
+ }
+
if (*cur_ref != '\0' && *cur_ns_prefix != '\0') {
/* reference argument given. skip namespace prefix using it.
diff -r 7bb0916b17ec src/imap/cmd-subscribe.c
--- a/src/imap/cmd-subscribe.c Wed Jun 27 23:23:06 2007 +0300
+++ b/src/imap/cmd-subscribe.c Wed Jun 27 23:48:23 2007 +0300
@@ -2,9 +2,11 @@
#include "common.h"
#include "commands.h"
+#include "namespace.h"
bool _cmd_subscribe_full(struct client_command_context *cmd, bool subscribe)
{
+ struct namespace *ns;
struct mail_storage *storage;
const char *mailbox, *verify_name;
@@ -13,20 +15,19 @@ bool _cmd_subscribe_full(struct client_c
return FALSE;
verify_name = mailbox;
+ ns = namespace_find_visible(cmd->client->namespaces, &mailbox);
+ if (ns == NULL) {
+ client_send_tagline(cmd, "NO Unknown namespace.");
+ return TRUE;
+ }
+ storage = ns->storage;
+ verify_name += strlen(ns->prefix);
+
if ((client_workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0 &&
- *mailbox != '\0') {
+ *mailbox != '\0' && mailbox[strlen(mailbox)-1] ==
+ mail_storage_get_hierarchy_sep(storage)) {
/* verify the validity without the trailing '/' */
- storage = client_find_storage(cmd, &mailbox);
- if (storage == NULL)
- return TRUE;
-
- if (mailbox[strlen(mailbox)-1] ==
- mail_storage_get_hierarchy_sep(storage))
- verify_name = t_strndup(mailbox, strlen(mailbox)-1);
- } else {
- storage = client_find_storage(cmd, &mailbox);
- if (storage == NULL)
- return TRUE;
+ verify_name = t_strndup(mailbox, strlen(mailbox)-1);
}
if (!client_verify_mailbox_name(cmd, verify_name, subscribe, FALSE))
signature.asc
Description: This is a digitally signed message part
