void index_transaction_init(struct mailbox_transaction_context *t, struct mailbox *box, enum mailbox_transaction_flags flags) { enum mail_index_transaction_flags itrans_flags; i_assert(box->opened); itrans_flags = index_transaction_flags_get(flags); if ((flags & MAILBOX_TRANSACTION_FLAG_REFRESH) != 0) mail_index_refresh(box->index); t->box = box; t->itrans = mail_index_transaction_begin(box->view, itrans_flags); t->view = mail_index_transaction_open_updated_view(t->itrans); array_create(&t->module_contexts, default_pool, sizeof(void *), 5); t->cache_view = mail_cache_view_open(box->cache, t->view); t->cache_trans = mail_cache_get_transaction(t->cache_view, t->itrans); if ((flags & MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC) != 0) mail_cache_view_update_cache_decisions(t->cache_view, FALSE); /* set up after mail_cache_get_transaction(), so that we'll still have the cache_trans available in _index_commit() */ t->super = t->itrans->v; t->itrans->v.commit = index_transaction_index_commit; t->itrans->v.rollback = index_transaction_index_rollback; MODULE_CONTEXT_SET(t->itrans, mail_storage_mail_index_module, t); }
void index_storage_mailbox_alloc(struct mailbox *box, const char *vname, enum mailbox_flags flags, const char *index_prefix) { static unsigned int mailbox_generation_sequence = 0; struct index_mailbox_context *ibox; i_assert(vname != NULL); box->generation_sequence = ++mailbox_generation_sequence; box->vname = p_strdup(box->pool, vname); box->name = p_strdup(box->pool, mailbox_list_get_storage_name(box->list, vname)); box->flags = flags; box->index_prefix = p_strdup(box->pool, index_prefix); p_array_init(&box->search_results, box->pool, 16); array_create(&box->module_contexts, box->pool, sizeof(void *), 5); ibox = p_new(box->pool, struct index_mailbox_context, 1); ibox->list_index_sync_ext_id = (uint32_t)-1; ibox->index_flags = MAIL_INDEX_OPEN_FLAG_CREATE | mail_storage_settings_to_index_flags(box->storage->set); if ((box->flags & MAILBOX_FLAG_SAVEONLY) != 0) ibox->index_flags |= MAIL_INDEX_OPEN_FLAG_SAVEONLY; ibox->next_lock_notify = time(NULL) + LOCK_NOTIFY_INTERVAL; MODULE_CONTEXT_SET(box, index_storage_module, ibox); box->inbox_user = strcmp(box->name, "INBOX") == 0 && (box->list->ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0; box->inbox_any = strcmp(box->name, "INBOX") == 0 && (box->list->ns->flags & NAMESPACE_FLAG_INBOX_ANY) != 0; }
static struct mailbox *antispam_mailbox_open(struct mail_storage *storage, const char *name, struct istream *input, enum mailbox_open_flags flags) { union mail_storage_module_context *as_storage = ANTISPAM_CONTEXT(storage); struct mailbox *box; struct antispam_mailbox *asbox; box = as_storage->super.mailbox_open(storage, name, input, flags); if (box == NULL) return NULL; asbox = p_new(box->pool, struct antispam_mailbox, 1); asbox->module_ctx.super = box->v; asbox->save_hack = FALSE; asbox->movetype = MMT_APPEND; if (need_folder_hook) { /* override save_init to override want_mail, we need that */ box->v.save_begin = antispam_save_begin; box->v.save_finish = antispam_save_finish; box->v.transaction_begin = antispam_mailbox_transaction_begin; box->v.transaction_commit = antispam_mailbox_transaction_commit; box->v.transaction_rollback = antispam_mailbox_transaction_rollback; box->v.copy = antispam_copy; } if (need_keyword_hook) box->v.mail_alloc = antispam_mailbox_mail_alloc; MODULE_CONTEXT_SET(box, antispam_storage_module, asbox); return box; }
void index_transaction_init(struct index_transaction_context *it, struct mailbox *box, enum mailbox_transaction_flags flags) { struct mailbox_transaction_context *t = &it->mailbox_ctx; enum mail_index_transaction_flags trans_flags; i_assert(box->opened); trans_flags = MAIL_INDEX_TRANSACTION_FLAG_AVOID_FLAG_UPDATES; if ((flags & MAILBOX_TRANSACTION_FLAG_HIDE) != 0) trans_flags |= MAIL_INDEX_TRANSACTION_FLAG_HIDE; if ((flags & MAILBOX_TRANSACTION_FLAG_EXTERNAL) != 0) trans_flags |= MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL; if ((flags & MAILBOX_TRANSACTION_FLAG_REFRESH) != 0) (void)mail_index_refresh(box->index); t->box = box; t->itrans = mail_index_transaction_begin(box->view, trans_flags); t->view = mail_index_transaction_open_updated_view(t->itrans); array_create(&t->module_contexts, default_pool, sizeof(void *), 5); it->cache_view = mail_cache_view_open(box->cache, t->view); it->cache_trans = mail_cache_get_transaction(it->cache_view, t->itrans); /* set up after mail_cache_get_transaction(), so that we'll still have the cache_trans available in _index_commit() */ it->super = t->itrans->v; t->itrans->v.commit = index_transaction_index_commit; t->itrans->v.rollback = index_transaction_index_rollback; MODULE_CONTEXT_SET(t->itrans, mail_storage_mail_index_module, it); }
struct sql_db * sql_db_cache_new(struct sql_db_cache *cache, const char *db_driver, const char *connect_string) { struct sql_db_cache_context *ctx; struct sql_db *db; char *key; key = i_strdup_printf("%s\t%s", db_driver, connect_string); db = hash_table_lookup(cache->dbs, key); if (db != NULL) { ctx = SQL_DB_CACHE_CONTEXT(db); if (ctx->refcount == 0) { sql_db_cache_unlink(ctx); ctx->prev = ctx->next = NULL; } i_free(key); } else { sql_db_cache_drop_oldest(cache); ctx = i_new(struct sql_db_cache_context, 1); ctx->cache = cache; ctx->key = key; db = sql_init(db_driver, connect_string); ctx->orig_deinit = db->v.deinit; db->v.deinit = sql_db_cache_db_deinit; MODULE_CONTEXT_SET(db, sql_db_cache_module, ctx); hash_table_insert(cache->dbs, ctx->key, db); } ctx->refcount++; return db; }
void fts_mailbox_allocated(struct mailbox *box) { struct fts_mailbox_list *flist = FTS_LIST_CONTEXT(box->list); struct mailbox_vfuncs *v = box->vlast; struct fts_mailbox *fbox; if (flist == NULL) return; fbox = p_new(box->pool, struct fts_mailbox, 1); fbox->module_ctx.super = *v; box->vlast = &fbox->module_ctx.super; v->get_status = fts_mailbox_get_status; v->search_init = fts_mailbox_search_init; v->search_next_nonblock = fts_mailbox_search_next_nonblock; v->search_next_update_seq = fts_mailbox_search_next_update_seq; v->search_deinit = fts_mailbox_search_deinit; v->transaction_begin = fts_transaction_begin; v->transaction_rollback = fts_transaction_rollback; v->transaction_commit = fts_transaction_commit; v->sync_notify = fts_mailbox_sync_notify; v->sync_deinit = fts_sync_deinit; v->save_finish = fts_save_finish; v->copy = fts_copy; MODULE_CONTEXT_SET(box, fts_storage_module, fbox); }
static void zlib_mail_user_created(struct mail_user *user) { struct mail_user_vfuncs *v = user->vlast; struct zlib_user *zuser; const char *name; zuser = p_new(user->pool, struct zlib_user, 1); zuser->module_ctx.super = *v; user->vlast = &zuser->module_ctx.super; v->deinit = zlib_mail_user_deinit; name = mail_user_plugin_getenv(user, "zlib_save"); if (name != NULL && *name != '\0') { zuser->save_handler = compression_lookup_handler(name); if (zuser->save_handler == NULL) i_error("zlib_save: Unknown handler: %s", name); else if (zuser->save_handler->create_ostream == NULL) { i_error("zlib_save: Support not compiled in for handler: %s", name); zuser->save_handler = NULL; } } name = mail_user_plugin_getenv(user, "zlib_save_level"); if (name != NULL) { if (str_to_uint(name, &zuser->save_level) < 0 || zuser->save_level < 1 || zuser->save_level > 9) { i_error("zlib_save_level: Level must be between 1..9"); zuser->save_level = 0; } } if (zuser->save_level == 0) zuser->save_level = ZLIB_PLUGIN_DEFAULT_LEVEL; MODULE_CONTEXT_SET(user, zlib_user_module, zuser); }
static void snarf_mailbox_allocated(struct mailbox *box) { struct snarf_mail_storage *sstorage = SNARF_CONTEXT(box->storage); struct mailbox_vfuncs *v = box->vlast; struct snarf_mailbox *sbox; struct mailbox_list *snarf_list; const char *snarf_name; if (!box->inbox_user) return; if (sstorage != NULL && sstorage->snarfing_disabled) return; if (!snarf_box_find(box->storage->user, &snarf_list, &snarf_name)) return; sbox = p_new(box->pool, struct snarf_mailbox, 1); sbox->module_ctx.super = *v; box->vlast = &sbox->module_ctx.super; sbox->snarf_box = mailbox_alloc(snarf_list, snarf_name, MAILBOX_FLAG_KEEP_LOCKED); v->sync_init = snarf_sync_init; v->free = snarf_mailbox_free; MODULE_CONTEXT_SET(box, snarf_storage_module, sbox); }
static void fts_mailbox_list_init(struct mailbox_list *list, const char *name) { struct fts_backend *backend; const char *path, *error; if (!mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX, &path)) { if (list->mail_set->mail_debug) { i_debug("fts: Indexes disabled for namespace '%s'", list->ns->prefix); } return; } if (fts_backend_init(name, list->ns, &error, &backend) < 0) { i_error("fts: Failed to initialize backend '%s': %s", name, error); } else { struct fts_mailbox_list *flist; struct mailbox_list_vfuncs *v = list->vlast; if ((backend->flags & FTS_BACKEND_FLAG_FUZZY_SEARCH) != 0) list->ns->user->fuzzy_search = TRUE; flist = p_new(list->pool, struct fts_mailbox_list, 1); flist->module_ctx.super = *v; flist->backend = backend; list->vlast = &flist->module_ctx.super; v->deinit = fts_mailbox_list_deinit; MODULE_CONTEXT_SET(list, fts_mailbox_list_module, flist); } }
static void mail_crypt_mail_user_created(struct mail_user *user) { struct mail_user_vfuncs *v = user->vlast; struct mail_crypt_user *muser; const char *error = NULL; muser = p_new(user->pool, struct mail_crypt_user, 1); muser->module_ctx.super = *v; user->vlast = &muser->module_ctx.super; const char *curve = mail_user_plugin_getenv(user, "mail_crypt_curve"); buffer_t *tmp = t_str_new(64); if (curve == NULL) { if (user->mail_debug) { i_debug("mail_crypt_plugin: mail_crypt_curve setting " "missing - generating EC keys disabled"); } } else if (!dcrypt_name2oid(curve, tmp, &error)) { user->error = p_strdup_printf(user->pool, "mail_crypt_plugin: " "invalid mail_crypt_curve setting %s: %s - " "plugin disabled", curve, error); } else { muser->curve = p_strdup(user->pool, curve); } const char *version = mail_user_plugin_getenv(user, "mail_crypt_save_version"); if (version == NULL) { user->error = p_strdup_printf(user->pool, "mail_crypt_plugin: " "mail_crypt_save_version setting missing " "- plugin disabled"); } else if (version[0] == '0') { muser->save_version = 0; } else if (version[0] == '1') { muser->save_version = 1; } else if (version[0] == '2') { muser->save_version = 2; } else { user->error = p_strdup_printf(user->pool, "mail_crypt_plugin: Invalid " "mail_crypt_save_version %s: use 0, 1, or 2 ", version); } if (mail_crypt_global_keys_load(user, "mail_crypt_global", &muser->global_keys, FALSE, &error) < 0) { user->error = p_strdup_printf(user->pool, "mail_crypt_plugin: %s", error); } v->deinit = mail_crypt_mail_user_deinit; MODULE_CONTEXT_SET(user, mail_crypt_user_module, muser); }
static struct mail_search_context * fts_mailbox_search_init(struct mailbox_transaction_context *t, struct mail_search_args *args, const enum mail_sort_type *sort_program, enum mail_fetch_field wanted_fields, struct mailbox_header_lookup_ctx *wanted_headers) { struct fts_transaction_context *ft = FTS_CONTEXT(t); struct fts_mailbox *fbox = FTS_CONTEXT(t->box); struct fts_mailbox_list *flist = FTS_LIST_CONTEXT(t->box->list); struct mail_search_context *ctx; struct fts_search_context *fctx; ctx = fbox->module_ctx.super.search_init(t, args, sort_program, wanted_fields, wanted_headers); if (!fts_backend_can_lookup(flist->backend, args->args)) return ctx; fctx = i_new(struct fts_search_context, 1); fctx->box = t->box; fctx->backend = flist->backend; fctx->t = t; fctx->args = args; fctx->result_pool = pool_alloconly_create("fts results", 1024*64); fctx->orig_matches = buffer_create_dynamic(default_pool, 64); fctx->virtual_mailbox = strcmp(t->box->storage->name, VIRTUAL_STORAGE_NAME) == 0; fctx->enforced = mail_user_plugin_getenv(t->box->storage->user, "fts_enforced") != NULL; i_array_init(&fctx->levels, 8); fctx->scores = i_new(struct fts_scores, 1); fctx->scores->refcount = 1; i_array_init(&fctx->scores->score_map, 64); MODULE_CONTEXT_SET(ctx, fts_storage_module, fctx); /* FIXME: we'll assume that all the args are fuzzy. not good, but would require much more work to fix it. */ if (!fts_args_have_fuzzy(args->args) && mail_user_plugin_getenv(t->box->storage->user, "fts_no_autofuzzy") != NULL) fctx->flags |= FTS_LOOKUP_FLAG_NO_AUTO_FUZZY; /* transaction contains the last search's scores. they can be queried later with mail_get_special() */ if (ft->scores != NULL) fts_scores_unref(&ft->scores); ft->scores = fctx->scores; ft->scores->refcount++; if (fctx->enforced || fts_want_build_args(args->args)) fts_try_build_init(ctx, fctx); else fts_search_lookup(fctx); return ctx; }
static void pop3_migration_mailbox_allocated(struct mailbox *box) { struct mailbox_vfuncs *v = box->vlast; struct pop3_migration_mailbox *mbox; mbox = p_new(box->pool, struct pop3_migration_mailbox, 1); mbox->module_ctx.super = *v; box->vlast = &mbox->module_ctx.super; MODULE_CONTEXT_SET(box, pop3_migration_storage_module, mbox); }
static void sieve_mail_user_created(struct mail_user *user) { struct sieve_mail_user *suser; struct mail_user_vfuncs *v = user->vlast; suser = p_new(user->pool, struct sieve_mail_user, 1); suser->module_ctx.super = *v; user->vlast = &suser->module_ctx.super; v->deinit = mail_sieve_user_deinit; MODULE_CONTEXT_SET(user, sieve_user_module, suser); }
static void imap_zlib_client_created(struct client **clientp) { struct client *client = *clientp; struct zlib_client *zclient; if (mail_user_is_plugin_loaded(client->user, imap_zlib_module) && compression_lookup_handler("deflate") != NULL) { zclient = p_new(client->pool, struct zlib_client, 1); MODULE_CONTEXT_SET(client, imap_zlib_imap_module, zclient); str_append(client->capability_string, " COMPRESS=DEFLATE"); }
static void acl_mailbox_list_init_shared(struct mailbox_list *list) { struct acl_mailbox_list *alist; struct mailbox_list_vfuncs *v = list->vlast; alist = p_new(list->pool, struct acl_mailbox_list, 1); alist->module_ctx.super = *v; list->vlast = &alist->module_ctx.super; v->deinit = acl_mailbox_list_deinit; v->iter_init = acl_mailbox_list_iter_init_shared; MODULE_CONTEXT_SET(list, acl_mailbox_list_module, alist); }
static void stats_register_notify_callbacks(struct mail_storage *storage) { struct stats_storage *sstorage = STATS_CONTEXT(storage); if (sstorage != NULL) return; sstorage = p_new(storage->pool, struct stats_storage, 1); sstorage->old_callbacks = storage->callbacks; storage->callbacks.notify_ok = stats_notify_ok; MODULE_CONTEXT_SET(storage, stats_storage_module, sstorage); }
static struct mailbox_transaction_context * fts_transaction_begin(struct mailbox *box, enum mailbox_transaction_flags flags) { struct fts_mailbox *fbox = FTS_CONTEXT(box); struct mailbox_transaction_context *t; struct fts_transaction_context *ft; ft = i_new(struct fts_transaction_context, 1); t = fbox->module_ctx.super.transaction_begin(box, flags); MODULE_CONTEXT_SET(t, fts_storage_module, ft); return t; }
static void snarf_mail_storage_create(struct mail_storage *storage, const char *path) { struct snarf_mail_storage *mstorage; struct mail_storage_vfuncs *v = storage->vlast; path = mail_user_home_expand(storage->user, path); mstorage = p_new(storage->pool, struct snarf_mail_storage, 1); mstorage->snarf_path = p_strdup(storage->pool, path); mstorage->module_ctx.super = *v; storage->vlast = &mstorage->module_ctx.super; v->mailbox_alloc = snarf_mailbox_alloc; MODULE_CONTEXT_SET(storage, snarf_storage_module, mstorage); }
static struct mailbox_transaction_context * zlib_mailbox_transaction_begin(struct mailbox *box, enum mailbox_transaction_flags flags) { union mailbox_module_context *zbox = ZLIB_CONTEXT(box); struct mailbox_transaction_context *t; struct zlib_transaction_context *zt; t = zbox->super.transaction_begin(box, flags); zt = i_new(struct zlib_transaction_context, 1); MODULE_CONTEXT_SET(t, zlib_storage_module, zt); return t; }
void acl_mailbox_allocated(struct mailbox *box) { struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(box->list); struct mailbox_vfuncs *v = box->vlast; struct acl_mailbox *abox; if (alist == NULL) { /* ACLs disabled */ return; } if (box->list->ns->type == MAIL_NAMESPACE_TYPE_SHARED && (box->list->ns->flags & NAMESPACE_FLAG_AUTOCREATED) == 0) { /* this is the root shared namespace, which itself doesn't have any existing mailboxes. */ return; } abox = p_new(box->pool, struct acl_mailbox, 1); abox->module_ctx.super = *v; box->vlast = &abox->module_ctx.super; /* aclobj can be used for setting ACLs, even when mailbox is opened with IGNORE_ACLS flag */ abox->aclobj = acl_object_init_from_name(alist->rights.backend, mailbox_get_name(box)); v->free = acl_mailbox_free; if ((box->flags & MAILBOX_FLAG_IGNORE_ACLS) == 0) { abox->acl_enabled = TRUE; v->is_readonly = acl_is_readonly; v->exists = acl_mailbox_exists; v->open = acl_mailbox_open; v->get_status = acl_mailbox_get_status; v->create_box = acl_mailbox_create; v->update_box = acl_mailbox_update; v->delete_box = acl_mailbox_delete; v->rename_box = acl_mailbox_rename; v->save_begin = acl_save_begin; v->copy = acl_copy; v->transaction_commit = acl_transaction_commit; v->attribute_set = acl_attribute_set; v->attribute_get = acl_attribute_get; v->attribute_iter_init = acl_attribute_iter_init; v->attribute_iter_next = acl_attribute_iter_next; v->attribute_iter_deinit = acl_attribute_iter_deinit; } MODULE_CONTEXT_SET(box, acl_storage_module, abox); }
static void mail_log_mail_user_created(struct mail_user *user) { struct mail_log_user *muser; const char *str; muser = p_new(user->pool, struct mail_log_user, 1); MODULE_CONTEXT_SET(user, mail_log_user_module, muser); str = mail_user_plugin_getenv(user, "mail_log_fields"); muser->fields = str == NULL ? MAIL_LOG_DEFAULT_FIELDS : mail_log_parse_fields(str); str = mail_user_plugin_getenv(user, "mail_log_events"); muser->events = str == NULL ? MAIL_LOG_DEFAULT_EVENTS : mail_log_parse_events(str); }
static struct mailbox_transaction_context * antispam_mailbox_transaction_begin(struct mailbox *box, enum mailbox_transaction_flags flags) { struct antispam_mailbox *asbox = ANTISPAM_CONTEXT(box); struct mailbox_transaction_context *t; struct antispam_transaction_context *ast; struct antispam_internal_context *aic; t = asbox->module_ctx.super.transaction_begin(box, flags); aic = i_new(struct antispam_internal_context, 1); ast = antispam_transaction_begin(box); aic->backendctx = ast; MODULE_CONTEXT_SET(t, antispam_storage_module, aic); return t; }
static void mail_log_action(struct mailbox_transaction_context *dest_trans, struct mail *mail, enum mail_log_event event, const char *data) { struct mail_log_transaction_context *lt = MAIL_LOG_CONTEXT(dest_trans); const char *msgid; uoff_t size; string_t *str; pool_t pool; if ((mail_log_set.events & event) == 0) return; if (lt == NULL) { pool = pool_alloconly_create("mail log transaction", 1024); lt = p_new(pool, struct mail_log_transaction_context, 1); lt->pool = pool; MODULE_CONTEXT_SET(dest_trans, mail_log_storage_module, lt); }
void fts_mail_allocated(struct mail *_mail) { struct mail_private *mail = (struct mail_private *)_mail; struct mail_vfuncs *v = mail->vlast; struct fts_mailbox *fbox = FTS_CONTEXT(_mail->box); struct fts_mail *fmail; if (fbox == NULL) return; fmail = p_new(mail->pool, struct fts_mail, 1); fmail->module_ctx.super = *v; mail->vlast = &fmail->module_ctx.super; fmail->virtual_mail = _mail->box->virtual_vfuncs != NULL; v->get_special = fts_mail_get_special; v->precache = fts_mail_precache; MODULE_CONTEXT_SET(mail, fts_mail_module, fmail); }
static struct mailbox_transaction_context * stats_transaction_begin(struct mailbox *box, enum mailbox_transaction_flags flags) { struct stats_user *suser = STATS_USER_CONTEXT(box->storage->user); struct stats_mailbox *sbox = STATS_CONTEXT(box); struct mailbox_transaction_context *trans; struct stats_transaction_context *strans; trans = sbox->module_ctx.super.transaction_begin(box, flags); trans->stats_track = TRUE; strans = i_new(struct stats_transaction_context, 1); strans->trans = trans; DLLIST_PREPEND(&suser->transactions, strans); MODULE_CONTEXT_SET(trans, stats_storage_module, strans); return trans; }
static int tika_get_http_client_url(struct mail_user *user, struct http_url **http_url_r) { struct fts_parser_tika_user *tuser = TIKA_USER_CONTEXT(user); struct http_client_settings http_set; const char *url, *error; url = mail_user_plugin_getenv(user, "fts_tika"); if (url == NULL) { /* fts_tika disabled */ return -1; } if (tuser != NULL) { *http_url_r = tuser->http_url; return *http_url_r == NULL ? -1 : 0; } tuser = p_new(user->pool, struct fts_parser_tika_user, 1); MODULE_CONTEXT_SET(user, fts_parser_tika_user_module, tuser); if (http_url_parse(url, NULL, 0, user->pool, &tuser->http_url, &error) < 0) { i_error("fts_tika: Failed to parse HTTP url %s: %s", url, error); return -1; } if (tika_http_client == NULL) { memset(&http_set, 0, sizeof(http_set)); http_set.max_idle_time_msecs = 100; http_set.max_parallel_connections = 1; http_set.max_pipelined_requests = 1; http_set.max_redirects = 1; http_set.max_attempts = 3; http_set.connect_timeout_msecs = 5*1000; http_set.request_timeout_msecs = 60*1000; http_set.debug = user->mail_debug; tika_http_client = http_client_init(&http_set); } *http_url_r = tuser->http_url; return 0; }
static struct mail_index_alloc_cache_list * mail_index_alloc_cache_add(struct mail_index *index, const char *mailbox_path, struct stat *st) { struct mail_index_alloc_cache_list *list; list = i_new(struct mail_index_alloc_cache_list, 1); list->refcount = 1; list->index = index; list->mailbox_path = i_strdup(mailbox_path); list->index_dir_dev = st->st_dev; list->index_dir_ino = st->st_ino; list->next = indexes; indexes = list; MODULE_CONTEXT_SET(index, mail_index_alloc_cache_index_module, list); return list; }
static void pop3_migration_mail_storage_created(struct mail_storage *storage) { struct pop3_migration_mail_storage *mstorage; struct mail_storage_vfuncs *v = storage->vlast; const char *pop3_box_vname; pop3_box_vname = mail_user_plugin_getenv(storage->user, "pop3_migration_mailbox"); if (pop3_box_vname == NULL) return; mstorage = p_new(storage->pool, struct pop3_migration_mail_storage, 1); mstorage->module_ctx.super = *v; storage->vlast = &mstorage->module_ctx.super; v->destroy = pop3_migration_mail_storage_destroy; mstorage->pop3_box_vname = p_strdup(storage->pool, pop3_box_vname); MODULE_CONTEXT_SET(storage, pop3_migration_storage_module, mstorage); }
static void acl_mailbox_list_init_default(struct mailbox_list *list) { struct mailbox_list_vfuncs *v = list->vlast; struct acl_mailbox_list *alist; if (list->mail_set->mail_full_filesystem_access) { /* not necessarily, but safer to do this for now. */ i_fatal("mail_full_filesystem_access=yes is " "incompatible with ACLs"); } alist = p_new(list->pool, struct acl_mailbox_list, 1); alist->module_ctx.super = *v; list->vlast = &alist->module_ctx.super; v->deinit = acl_mailbox_list_deinit; v->iter_init = acl_mailbox_list_iter_init; v->iter_next = acl_mailbox_list_iter_next; v->iter_deinit = acl_mailbox_list_iter_deinit; MODULE_CONTEXT_SET(list, acl_mailbox_list_module, alist); }
static void mail_filter_mail_user_created(struct mail_user *user) { struct mail_user_vfuncs *v = user->vlast; struct mail_filter_user *muser; muser = p_new(user->pool, struct mail_filter_user, 1); muser->module_ctx.super = *v; user->vlast = &muser->module_ctx.super; mail_filter_parse_setting(user, "mail_filter", &muser->socket_path, &muser->args); mail_filter_parse_setting(user, "mail_filter_out", &muser->out_socket_path, &muser->out_args); if (user->mail_debug && muser->socket_path == NULL && muser->out_socket_path == NULL) { i_debug("mail_filter and mail_filter_out settings missing, " "ignoring mail_filter plugin"); } MODULE_CONTEXT_SET(user, mail_filter_user_module, muser); }