raw-storage.c revision 744543d840a229fe893843046d143186971560e2
2454dfa32c93c20a8522c6ed42fe057baaac9f9aStephan Bosch/* Copyright (c) 2007-2012 Dovecot authors, see the included COPYING file */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenraw_storage_create_from_set(const struct setting_parser_info *set_info,
300e4e43ed1ca46d0614459161ca2fb460ef661aTimo Sirainen user = mail_user_alloc("raw mail user", set_info, set);
300e4e43ed1ca46d0614459161ca2fb460ef661aTimo Sirainen i_fatal("Raw user initialization failed: %s", error);
300e4e43ed1ca46d0614459161ca2fb460ef661aTimo Sirainen ns_set = p_new(user->pool, struct mail_namespace_settings, 1);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* raw storage doesn't have INBOX. We especially don't want LIST to
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return INBOX. */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if (mail_storage_create(ns, "raw", 0, &error) < 0)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen i_fatal("Couldn't create internal raw storage: %s", error);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenraw_mailbox_alloc_common(struct mail_user *user, struct istream *input,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const char *envelope_sender, struct mailbox **box_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen name = path != NULL ? path : i_stream_get_name(input);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen i_assert(strcmp(box->storage->name, RAW_STORAGE_NAME) == 0);
2adcf55dd8b0380cb2f1d2fd53accf448053d5d3Timo Sirainenint raw_mailbox_alloc_stream(struct mail_user *user, struct istream *input,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen time_t received_time, const char *envelope_sender,
b97e952db93a681968777dfda9728cc92ff0d7c4Timo Sirainen return raw_mailbox_alloc_common(user, input, NULL, received_time,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint raw_mailbox_alloc_path(struct mail_user *user, const char *path,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen time_t received_time, const char *envelope_sender,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return raw_mailbox_alloc_common(user, NULL, path, received_time,
cf7857bce68a33cdabe88bb15568e21921eb5ac7Aki Tuomistatic struct mail_storage *raw_storage_alloc(void)
74c369c0587c5f6bb13d730675d8bc455c5c3f8eTimo Sirainen pool = pool_alloconly_create("raw storage", 512+256);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenraw_storage_get_list_settings(const struct mail_namespace *ns ATTR_UNUSED,
935960e45571872e38f730964f8ca1d116a1b532Timo Sirainen set->subscription_fname = RAW_SUBSCRIPTION_FILE_NAME;
935960e45571872e38f730964f8ca1d116a1b532Timo Sirainenstatic struct mailbox *
935960e45571872e38f730964f8ca1d116a1b532Timo Sirainenraw_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
935960e45571872e38f730964f8ca1d116a1b532Timo Sirainen flags |= MAILBOX_FLAG_READONLY | MAILBOX_FLAG_NO_INDEX_FILES;
935960e45571872e38f730964f8ca1d116a1b532Timo Sirainen pool = pool_alloconly_create("raw mailbox", 1024*3);
const char *path;
int fd;
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,