struct mail_storage_module_hooks {
struct module *module;
const struct mail_storage_hooks *hooks;
+ bool forced;
};
struct hook_stack {
void mail_storage_hooks_init(void)
{
- i_array_init(&module_hooks, 32);
+ if (!array_is_created(&module_hooks))
+ i_array_init(&module_hooks, 32);
i_array_init(&internal_hooks, 8);
}
new_hook.module = module;
new_hook.hooks = hooks;
+ /* allow adding hooks before mail_storage_hooks_init() */
+ if (!array_is_created(&module_hooks))
+ i_array_init(&module_hooks, 32);
array_append(&module_hooks, &new_hook, 1);
}
+void mail_storage_hooks_add_forced(struct module *module,
+ const struct mail_storage_hooks *hooks)
+{
+ struct mail_storage_module_hooks *hook;
+
+ mail_storage_hooks_add(module, hooks);
+ hook = array_idx_modifiable(&module_hooks,
+ array_count(&module_hooks)-1);
+ hook->forced = TRUE;
+}
+
void mail_storage_hooks_remove(const struct mail_storage_hooks *hooks)
{
const struct mail_storage_module_hooks *module_hook;
plugins = t_strsplit_spaces(user->set->mail_plugins, ", ");
array_foreach(&module_hooks, module_hook) {
name = module_get_plugin_name(module_hook->module);
- if (str_array_find(plugins, name))
+ if (str_array_find(plugins, name) || module_hook->forced)
array_append(&tmp_hooks, module_hook, 1);
}
void mail_storage_hooks_add(struct module *module,
const struct mail_storage_hooks *hooks);
+/* Add hooks to this plugin regardless of whether it exists in user's
+ mail_plugins setting. */
+void mail_storage_hooks_add_forced(struct module *module,
+ const struct mail_storage_hooks *hooks);
void mail_storage_hooks_remove(const struct mail_storage_hooks *hooks);
void mail_storage_hooks_add_internal(const struct mail_storage_hooks *hooks);
unsigned int mail_storage_get_lock_timeout(struct mail_storage *storage,
unsigned int secs);
void mail_storage_free_binary_cache(struct mail_storage *storage);
+int mailbox_attribute_value_to_string(struct mail_storage *storage,
+ const struct mail_attribute_value *value,
+ const char **str_r);
enum mail_index_open_flags
mail_storage_settings_to_index_flags(const struct mail_storage_settings *set);