summaryrefslogtreecommitdiffstats
path: root/src/lib-storage/fail-mail-storage.c
blob: f89d6f6ab8b013e6a8aaa4619c9c5250b8d37237 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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;
}