mail-storage.c revision 8a5fe0c06f48b202a5f1d3dd49f7ed7ed92d64ae
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina/* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file */
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březinaextern struct mail_search_register *mail_search_register_imap;
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březinaextern struct mail_search_register *mail_search_register_human;
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březinastruct mail_storage_module_register mail_storage_module_register = { 0 };
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březinastruct mail_module_register mail_module_register = { 0 };
e6092759dc4268b105b79478aa9b1398f21ed7a9Pavel Březinastruct mail_storage_mail_index_module mail_storage_mail_index_module =
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina MODULE_CONTEXT_INIT(&mail_index_module_register);
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina mail_search_register_deinit(&mail_search_register_human);
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina mail_search_register_deinit(&mail_search_register_imap);
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březinavoid mail_storage_class_register(struct mail_storage *storage_class)
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina i_assert(mail_storage_find_class(storage_class->name) == NULL);
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina /* append it after the list, so the autodetection order is correct */
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina array_append(&mail_storage_classes, &storage_class, 1);
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březinavoid mail_storage_class_unregister(struct mail_storage *storage_class)
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina unsigned int i, count;
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina classes = array_get(&mail_storage_classes, &count);
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina for (i = 0; i < count; i++) {
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březinastruct mail_storage *mail_storage_find_class(const char *name)
unsigned int i, count;
for (i = 0; i < count; i++) {
return classes[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;