summaryrefslogtreecommitdiffstats
path: root/src/lib-storage/fail-mail-storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib-storage/fail-mail-storage.c')
-rw-r--r--src/lib-storage/fail-mail-storage.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/lib-storage/fail-mail-storage.c b/src/lib-storage/fail-mail-storage.c
new file mode 100644
index 0000000..f89d6f6
--- /dev/null
+++ b/src/lib-storage/fail-mail-storage.c
@@ -0,0 +1,61 @@
+/* Copyright (c) 2009-2018 Dovecot authors, see the included COPYING file */
+
+#include "lib.h"
+#include "array.h"
+#include "mail-storage-private.h"
+#include "fail-mail-storage.h"
+
+static struct mail_storage *fail_storage_alloc(void)
+{
+ struct mail_storage *storage;
+ pool_t pool;
+
+ pool = pool_alloconly_create("fail mail storage", 1024);
+ storage = p_new(pool, struct mail_storage, 1);
+ *storage = fail_storage;
+ storage->pool = pool;
+ return storage;
+}
+
+static void fail_storage_destroy(struct mail_storage *storage ATTR_UNUSED)
+{
+}
+
+static void
+fail_storage_get_list_settings(const struct mail_namespace *ns ATTR_UNUSED,
+ struct mailbox_list_settings *set)
+{
+ if (set->layout == NULL)
+ set->layout = "fail";
+ if (set->subscription_fname == NULL)
+ set->subscription_fname = "subscriptions";
+}
+
+struct mail_storage fail_storage = {
+ .name = "fail",
+ .class_flags = MAIL_STORAGE_CLASS_FLAG_NO_ROOT,
+
+ .v = {
+ NULL,
+ fail_storage_alloc,
+ NULL,
+ fail_storage_destroy,
+ NULL,
+ fail_storage_get_list_settings,
+ NULL,
+ fail_mailbox_alloc,
+ NULL,
+ NULL,
+ }
+};
+
+struct mail_storage *fail_mail_storage_create(void)
+{
+ struct mail_storage *storage;
+
+ storage = fail_storage_alloc();
+ storage->refcount = 1;
+ storage->storage_class = &fail_storage;
+ p_array_init(&storage->module_contexts, storage->pool, 5);
+ return storage;
+}