comparison src/lib-storage/index/shared/shared-storage.c @ 8319:8553bb4c53ad HEAD

Fixed shared mailboxes to work with plugins.
author Timo Sirainen <tss@iki.fi>
date Thu, 23 Oct 2008 20:15:16 +0300
parents 4296aa3fbb75
children b46cf0979768
comparison
equal deleted inserted replaced
8318:836c8c2b87f5 8319:8553bb4c53ad
22 22
23 pool = pool_alloconly_create("shared storage", 256); 23 pool = pool_alloconly_create("shared storage", 256);
24 storage = p_new(pool, struct shared_storage, 1); 24 storage = p_new(pool, struct shared_storage, 1);
25 storage->storage = shared_storage; 25 storage->storage = shared_storage;
26 storage->storage.pool = pool; 26 storage->storage.pool = pool;
27 storage->storage.storage_class = &shared_storage;
27 28
28 return &storage->storage; 29 return &storage->storage;
29 } 30 }
30 31
31 static int shared_create(struct mail_storage *_storage, const char *data, 32 static int shared_create(struct mail_storage *_storage, const char *data,
225 } 226 }
226 227
227 if (shared_storage_get_namespace(storage, &name, &ns) < 0) 228 if (shared_storage_get_namespace(storage, &name, &ns) < 0)
228 return NULL; 229 return NULL;
229 230
230 box = mailbox_open(ns->storage, name, NULL, flags); 231 /* if we call the normal mailbox_open() here the plugins will see
232 mailbox_open() called twice and they could break. */
233 box = ns->storage->storage_class->v.
234 mailbox_open(ns->storage, name, NULL, flags);
231 if (box == NULL) 235 if (box == NULL)
232 shared_mailbox_copy_error(storage, ns); 236 shared_mailbox_copy_error(storage, ns);
233 return box; 237 return box;
234 } 238 }
235 239