mail-storage.c revision e4bb4fcb6dc5d4406857f86f4b5fa684abfa368d
/* Copyright (C) 2002-2007 Timo Sirainen */
#include "lib.h"
#include "ioloop.h"
#include "array.h"
#include "var-expand.h"
#include "mail-index-private.h"
#include "mailbox-list-private.h"
#include "mail-storage-private.h"
#include "mail-namespace.h"
#include "index/index-storage.h"
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
/* Message to show to users when critical error occurs */
#define CRITICAL_MSG \
"Internal error occurred. Refer to server log for more information."
struct mail_storage_module_register mail_storage_module_register = { 0 };
struct mail_module_register mail_module_register = { 0 };
void mail_storage_init(void)
{
}
void mail_storage_deinit(void)
{
if (array_is_created(&storages))
}
{
storage_class->v.class_init();
/* append it after the list, so the autodetection order is correct */
}
{
struct mail_storage *const *classes;
unsigned int i, count;
for (i = 0; i < count; i++) {
if (classes[i] == storage_class) {
break;
}
}
storage_class->v.class_deinit();
}
enum file_lock_method *lock_method_r)
{
const char *str;
*flags_r = 0;
else
}
{
struct mail_storage *const *classes;
unsigned int i, count;
for (i = 0; i < count; i++) {
return classes[i];
}
return NULL;
}
static struct mail_storage *
{
struct mail_storage *const *classes;
unsigned int i, count;
for (i = 0; i < count; i++) {
return classes[i];
}
return NULL;
}
static void
enum mail_storage_flags *flags)
{
const char *p;
/* check if data is in driver:data format (eg. mbox:~/mail) */
p = *data;
while (i_isalnum(*p)) p++;
if (*p == ':' && p != *data) {
/* no autodetection if the storage format is given. */
*data = p + 1;
}
}
enum mail_storage_flags flags,
enum file_lock_method lock_method)
{
struct mail_storage *const *classes;
unsigned int i, count;
data = "";
/* use the first driver that works */
if (storage_class == NULL) {
i_error("Ambiguous mail location setting, "
"don't know what to do with it: %s "
"(try prefixing it with mbox: or maildir:)",
data);
return -1;
}
classes = &storage_class;
count = 1;
} else {
if (storage_class == NULL)
return -1;
classes = &storage_class;
count = 1;
}
for (i = 0; i < count; i++) {
break;
/* try the next one */
}
if (i == count)
return -1;
if (hook_mail_storage_created != NULL)
return 0;
}
{
}
{
}
{
}
{
char str[256];
}
const char *fmt, ...)
{
/* critical errors may contain sensitive data, so let user
see only "Internal error" with a timestamp to make it
easier to look from log files the actual error message. */
}
}
{
}
{
}
{
}
struct mail_storage_callbacks *callbacks,
void *context)
{
}
bool directory)
{
"Invalid mailbox name");
return -1;
}
}
enum mail_error *error_r)
{
/* We get here only in error situations, so we have to return some
error. If storage->error is NONE, it means we forgot to set it at
some point.. */
"BUG: Unknown internal error";
}
/* This shouldn't happen.. */
i_strdup_printf("BUG: Unknown 0x%x error",
}
return storage->error_string;
}
{
if (*name == '\0')
}
const char *name)
{
if (*name == '\0')
}
const char *name)
{
if (*name == '\0')
}
enum mailbox_list_flags
{
enum mailbox_list_flags list_flags = 0;
if ((storage_flags & MAIL_STORAGE_FLAG_DEBUG) != 0)
if ((storage_flags & MAIL_STORAGE_FLAG_FULL_FS_ACCESS) != 0)
if ((storage_flags & MAIL_STORAGE_FLAG_DOTLOCK_USE_EXCL) != 0)
return list_flags;
}
{
const char *error_string;
enum mail_error error;
return FALSE;
return TRUE;
}
enum mailbox_open_flags flags)
{
"Invalid mailbox name");
return NULL;
}
return box;
}
{
}
{
}
{
}
{
}
{
}
enum mailbox_status_items items,
struct mailbox_status *status)
{
}
struct mailbox_sync_context *
{
}
struct mailbox_sync_rec *sync_rec_r)
{
}
struct mailbox_status *status_r)
{
}
{
}
{
}
struct mail_keywords *
const char *const keywords[])
{
}
void mailbox_keywords_free(struct mailbox_transaction_context *t,
struct mail_keywords **_keywords)
{
}
{
}
struct mailbox_header_lookup_ctx *
{
}
{
}
struct mail_search_context *
mailbox_search_init(struct mailbox_transaction_context *t,
const enum mail_sort_type *sort_program)
{
}
{
}
{
bool tryagain;
int ret;
&tryagain)) == 0) {
if (!tryagain)
break;
}
return ret;
}
{
}
struct mailbox_transaction_context *
{
box->transaction_count++;
}
int mailbox_transaction_commit(struct mailbox_transaction_context **t,
enum mailbox_sync_flags flags)
{
}
enum mailbox_sync_flags flags,
{
struct mailbox_transaction_context *t = *_t;
t->box->transaction_count--;
}
{
struct mailbox_transaction_context *t = *_t;
t->box->transaction_count--;
t->box->v.transaction_rollback(t);
}
{
return box->transaction_count;
}
int mailbox_save_init(struct mailbox_transaction_context *t,
{
return -1;
return 0;
}
{
}
{
}
{
}
{
}
{
}