comparison src/lib-storage/index/shared/shared-storage.c @ 8254:c465b10a76fd HEAD

Shared mailboxes: First mailbox access failed if virtual separator didn't match real separator.
author Timo Sirainen <tss@iki.fi>
date Wed, 08 Oct 2008 22:09:59 +0300
parents 6dd0c6755afe
children 4296aa3fbb75
comparison
equal deleted inserted replaced
8253:c9b9b551eb3f 8254:c465b10a76fd
169 str_append(prefix, _storage->ns->prefix); 169 str_append(prefix, _storage->ns->prefix);
170 var_expand(prefix, storage->ns_prefix_pattern, tab); 170 var_expand(prefix, storage->ns_prefix_pattern, tab);
171 171
172 ns = mail_namespace_find_prefix(user->namespaces, str_c(prefix)); 172 ns = mail_namespace_find_prefix(user->namespaces, str_c(prefix));
173 if (ns != NULL) { 173 if (ns != NULL) {
174 *_name = name; 174 *_name = mail_namespace_fix_sep(ns, name);
175 *ns_r = ns; 175 *ns_r = ns;
176 return 0; 176 return 0;
177 } 177 }
178 178
179 /* create the new namespace */ 179 /* create the new namespace */
180 ns = p_new(user->pool, struct mail_namespace, 1); 180 ns = p_new(user->pool, struct mail_namespace, 1);
181 ns->type = NAMESPACE_SHARED; 181 ns->type = NAMESPACE_SHARED;
182 ns->user = user; 182 ns->user = user;
183 ns->prefix = p_strdup(user->pool, str_c(prefix)); 183 ns->prefix = p_strdup(user->pool, str_c(prefix));
184 ns->flags = NAMESPACE_FLAG_LIST | NAMESPACE_FLAG_HIDDEN; 184 ns->flags = NAMESPACE_FLAG_LIST | NAMESPACE_FLAG_HIDDEN;
185 ns->sep = _storage->ns->sep;
185 186
186 location = t_str_new(256); 187 location = t_str_new(256);
187 var_expand(location, storage->location, tab); 188 var_expand(location, storage->location, tab);
188 if (mail_storage_create(ns, NULL, str_c(location), _storage->flags, 189 if (mail_storage_create(ns, NULL, str_c(location), _storage->flags,
189 _storage->lock_method, &error) < 0) { 190 _storage->lock_method, &error) < 0) {
192 } 193 }
193 /* FIXME: we could remove namespaces here that don't have usable 194 /* FIXME: we could remove namespaces here that don't have usable
194 mailboxes. otherwise the memory usage could just keep growing. */ 195 mailboxes. otherwise the memory usage could just keep growing. */
195 mail_user_add_namespace(user, ns); 196 mail_user_add_namespace(user, ns);
196 197
197 *_name = name; 198 *_name = mail_namespace_fix_sep(ns, name);
198 *ns_r = ns; 199 *ns_r = ns;
199 return 0; 200 return 0;
200 } 201 }
201 202
202 static void shared_mailbox_copy_error(struct mail_storage *shared_storage, 203 static void shared_mailbox_copy_error(struct mail_storage *shared_storage,