mbox-storage.c revision 0cb1eb9a12488be403e4179877c31729efaa3c2f
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen/* Copyright (c) 2002-2010 Dovecot authors, see the included COPYING file */
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen/* How often to touch the dotlock file when using KEEP_LOCKED flag */
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen/* Assume that if atime < mtime, there are new mails. If it's good enough for
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen UW-IMAP, it's good enough for us. */
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen (st).st_atime < (st).st_mtime ? MAILBOX_MARKED : MAILBOX_UNMARKED)
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen/* NOTE: must be sorted for istream-header-filter. Note that it's not such
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen a good idea to change this list, as the messages will then change from
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen client's point of view. So if you do it, change all mailboxes' UIDVALIDITY
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen so all caches are reset. */
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainenconst char *mbox_hide_headers[] = {
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen "Content-Length",
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen "X-IMAPbase",
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen "X-Keywords",
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainenunsigned int mbox_hide_headers_count = N_ELEMENTS(mbox_hide_headers);
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen/* A bit ugly duplification of the above list. It's safe to modify this list
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen without bad side effects, just keep the list sorted. */
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen "Content-Length",
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen "X-Delivery-ID"
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen "X-IMAPbase",
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen "X-Keywords",
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainenunsigned int mbox_save_drop_headers_count = N_ELEMENTS(mbox_save_drop_headers);
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainenstatic MODULE_CONTEXT_DEFINE_INIT(mbox_mailbox_list_module,
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainenint mbox_set_syscall_error(struct mbox_mailbox *mbox, const char *function)
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen mail_storage_set_error(&mbox->storage->storage,
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen mail_storage_set_critical(&mbox->storage->storage,
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen "%s failed with mbox file %s: %m",
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainenstatic const char *
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainenmbox_list_get_path(struct mailbox_list *list, const char *name,
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen struct mbox_mailbox_list *mlist = MBOX_LIST_CONTEXT(list);
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen const char *path, *p;
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen path = mlist->module_ctx.super.get_path(list, name, type);
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen return t_strconcat(path, "/"MBOX_INDEX_DIR_NAME, NULL);
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainenstatic struct mail_storage *mbox_storage_alloc(void)
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen pool = pool_alloconly_create("mbox storage", 512+256);
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen storage = p_new(pool, struct mbox_storage, 1);
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainenmbox_storage_create(struct mail_storage *_storage, struct mail_namespace *ns,
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen struct mbox_storage *storage = (struct mbox_storage *)_storage;
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen const char *dir;
9761e0036c87f459abe040632e1252f794ffe5f7Timo Sirainen storage->set = mail_storage_get_driver_settings(_storage);
if (debug) {
return FALSE;
if (debug) {
return FALSE;
if (debug) {
return FALSE;
if (debug)
return TRUE;
if (debug) {
return FALSE;
if (debug) {
return FALSE;
if (debug) {
return FALSE;
if (debug)
return TRUE;
return TRUE;
return TRUE;
return TRUE;
return FALSE;
if (debug)
return path;
return path;
return NULL;
const char *path;
if (debug)
return path;
if (debug)
if (debug)
return path;
if (debug)
return NULL;
return FALSE;
if (debug)
return FALSE;
debug);
return TRUE;
return FALSE;
return FALSE;
static struct mailbox *
const char *rootdir;
bool move_to_memory;
int ret;
else if (ret == 0) {
int ret;
return ret;
int fd;
(void)restrict_access_use_priv_gid();
rootdir);
bool directory)
if (directory &&
if (ret < 0)
if (ret == 0) {
const char *name)
unsigned int len;
return TRUE;
static struct mailbox_transaction_context *
if (lock_id != 0)
(struct mbox_transaction_context *)t;
int ret;
return ret;
(struct mbox_transaction_context *)t;
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,