mail-storage.c revision 27d0b2cd12e4118f494d36df21e575d00033be60
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file */
fc7b17677ac1a5fa3f7fe13d5ef7dcfea8d9b4a1Timo Sirainenextern struct mail_search_register *mail_search_register_imap;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenextern struct mail_search_register *mail_search_register_human;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenstruct mail_storage_module_register mail_storage_module_register = { 0 };
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenstruct mail_module_register mail_module_register = { 0 };
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenstruct mail_storage_mail_index_module mail_storage_mail_index_module =
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen MODULE_CONTEXT_INIT(&mail_index_module_register);
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen mail_search_register_deinit(&mail_search_register_human);
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen mail_search_register_deinit(&mail_search_register_imap);
43d32cbe60fdaef2699d99f1ca259053e9350411Timo Sirainenvoid mail_storage_class_register(struct mail_storage *storage_class)
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen i_assert(mail_storage_find_class(storage_class->name) == NULL);
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen /* append it after the list, so the autodetection order is correct */
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen array_append(&mail_storage_classes, &storage_class, 1);
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainenvoid mail_storage_class_unregister(struct mail_storage *storage_class)
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen unsigned int i, count;
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen classes = array_get(&mail_storage_classes, &count);
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen for (i = 0; i < count; i++) {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenstruct mail_storage *mail_storage_find_class(const char *name)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen unsigned int i, count;
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen classes = array_get(&mail_storage_classes, &count);
b87a4156eca6dcf6b29c504eb0cb9be2fdb11b63Timo Sirainen for (i = 0; i < count; i++) {
return NULL;
static struct mail_storage *
unsigned int i, count;
for (i = 0; i < count; i++) {
return classes[i];
return NULL;
p = *data;
static struct mail_storage *
const char *home;
return NULL;
return NULL;
return storage_class;
return storage_class;
return NULL;
const char **error_r)
} else if (!autocreate) {
bool autocreate;
int ret;
&root_dir)) {
if (ret == 0) {
error_r);
return FALSE;
return FALSE;
return FALSE;
return TRUE;
static struct mail_storage *
return storage;
return NULL;
const char **error_r)
error_r) < 0)
error_r);
T_BEGIN {
} T_END;
const char *str;
const char *fmt, ...)
error_r);
const char *str;
const char *str;
const struct mail_storage_settings *
void *context)
return error;
const char *error_string;
return FALSE;
return FALSE;
return TRUE;
const struct mailbox_settings *
return NULL;
return *box_set;
return NULL;
T_BEGIN {
if (open_error != 0)
} T_END;
return box;
const char *vname;
&metadata) < 0) {
return box;
return box;
return TRUE;
const char *errstr;
MAILBOX_SET_AUTO_SUBSCRIBE) == 0) {
int ret;
return ret;
const char **error_r)
if (prev_sep) {
return FALSE;
if (prev_sep && i > 0) {
return FALSE;
return TRUE;
vname++;
const char *path;
&path) < 0)
return TRUE;
return FALSE;
const char *name;
name++;
const char *name)
NAMESPACE_FLAG_LIST_CHILDREN)) == 0)
return TRUE;
return FALSE;
case MAIL_ERROR_NOTFOUND:
int ret;
case MAIL_ERROR_NOTFOUND:
MAIL_STORAGE_CLASS_FLAG_OPEN_STREAMS) == 0) {
T_BEGIN {
} T_END;
} T_END;
if (ret < 0) {
return FALSE;
return FALSE;
return FALSE;
if (ret < 0)
return FALSE;
return TRUE;
const char *index_dir;
int ret;
&index_dir);
if (ret <= 0)
int ret;
return ret;
const char *name1;
return FALSE;
return TRUE;
bool directory)
int ret;
if (ret == 0) {
return ret;
int ret;
return ret;
int ret;
if (ret < 0)
if (del)
if (del) {
if (ret < 0)
int ret;
return ret;
int ret;
return ret;
const char **error_r)
return TRUE;
return FALSE;
return FALSE;
return TRUE;
const char **error_r)
return FALSE;
return FALSE;
return FALSE;
return TRUE;
int ret = 0;
return ret;
struct mail_namespace *
return FALSE;
i_unreached();
struct mailbox_sync_context *
T_BEGIN {
} T_END;
return ctx;
const char *errormsg;
int ret;
if (ret == 0)
return ret;
struct mail_search_context *
int ret;
return ret;
bool tryagain;
if (!tryagain)
return FALSE;
return TRUE;
return FALSE;
return TRUE;
int ret;
if (ret < 0)
return ret;
struct mailbox_transaction_context *
return trans;
int ret;
return ret;
int ret;
T_BEGIN {
} T_END;
return ret;
const char *reason)
struct mailbox *
return t->box;
struct mail_save_context *
T_BEGIN {
} T_END;
return ctx;
const char *const *keywords_list;
const char *envelope)
unsigned int order)
int ret;
} else T_BEGIN {
} T_END;
if (ret < 0) {
int ret;
T_BEGIN {
} T_END;
return ret;
int ret;
T_BEGIN {
} T_END;
if (pvt_flags != 0)
t->save_count++;
return ret;
T_BEGIN {
} T_END;
struct mailbox_transaction_context *
int ret;
T_BEGIN {
} T_END;
if (ret == 0) {
if (pvt_flags != 0)
t->save_count++;
return ret;
int ret;
return ret;
int ret;
if (ret < 0) {
return ret;
const char **path_r)
int *fd_r)
int fd;
const char *root_dir;
int ret;
return ret;
&mail_dir) < 0)
unsigned int secs)
#ifndef MMAP_CONFLICTS_WRITE
return index_flags;
bool *utc_r)
unsigned int secs;
const char *error;
T_BEGIN {
} T_END;