I'm not sure why the original code was trying to add it to multiple
namespaces. A single mailbox name should be matching only a single
namespace (visible one at least). In any case we can't use
mail_namespace_find() with only partial namespaces-list, because it'll
assert-crash if it can't find a namespace for the mailbox.
{
struct mail_namespace *ns;
- /* add to all matching namespaces */
- for (ns = ctx->client->user->namespaces; ns != NULL; ns = ns->next) {
- if (mail_namespace_find(ns, name) == ns)
- cmd_notify_add_mailbox(ctx, ns, name, type, events);
- }
+ ns = mail_namespace_find(ctx->client->user->namespaces, name);
+ cmd_notify_add_mailbox(ctx, ns, name, type, events);
}
static int