dovecot-2.0-sieve: Further developed support for Sieve engine plugins.
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Thu Dec 31 20:56:30 EET 2009
details: http://hg.rename-it.nl/dovecot-2.0-sieve/rev/6225e0693c48
changeset: 1165:6225e0693c48
user: Stephan Bosch <stephan at rename-it.nl>
date: Thu Dec 31 19:47:01 2009 +0100
description:
Further developed support for Sieve engine plugins.
diffstat:
src/lib-sieve/sieve-plugins.c | 69 +++++++++++++---------------------
1 files changed, 27 insertions(+), 42 deletions(-)
diffs (105 lines):
diff -r a55b319681bc -r 6225e0693c48 src/lib-sieve/sieve-plugins.c
--- a/src/lib-sieve/sieve-plugins.c Thu Dec 31 18:10:46 2009 +0100
+++ b/src/lib-sieve/sieve-plugins.c Thu Dec 31 19:47:01 2009 +0100
@@ -46,11 +46,7 @@
/* Strip module names */
- len = strlen(module->name);
- if (len > 7 && strcmp(module->name + len - 7, "_plugin") == 0)
- mod_name = t_strndup(module->name, len - 7);
- else
- mod_name = module->name;
+ mod_name = module_get_plugin_name(module);
if ( strcmp(mod_path, path) == 0 && strcmp(mod_name, name) == 0 )
return module;
@@ -63,9 +59,9 @@
void sieve_plugins_load(struct sieve_instance *svinst, const char *path, const char *plugins)
{
- struct module *module;
+ struct module *new_modules, *module;
+ struct module_dir_load_settings mod_set;
const char **module_names;
- string_t *missing_modules;
unsigned int i;
/* Determine what to load */
@@ -81,45 +77,27 @@
if ( path == NULL || *path == '\0' )
path = MODULEDIR"/sieve";
- module_names = t_strsplit_spaces(plugins, ", ");
+ memset(&mod_set, 0, sizeof(mod_set));
+ mod_set.version = SIEVE_VERSION;
+ mod_set.require_init_funcs = TRUE;
+ mod_set.debug = FALSE;
- for (i = 0; module_names[i] != NULL; i++) {
- /* Allow giving the module names also in non-base form. */
- module_names[i] = module_file_get_name(module_names[i]);
- }
+ /* Load missing plugin modules */
- /* Load missing modules
- * FIXME: Dovecot should provide this functionality (v2.0 does)
- */
+ new_modules = module_dir_load_missing
+ (sieve_modules, path, plugins, &mod_set);
- missing_modules = t_str_new(256);
+ if ( sieve_modules == NULL ) {
+ /* No modules loaded yet */
+ sieve_modules = new_modules;
+ } else {
+ /* Find the end of the list */
+ module = sieve_modules;
+ while ( module != NULL && module->next != NULL )
+ module = module->next;
- for (i = 0; module_names[i] != NULL; i++) {
- const char *name = module_names[i];
-
- if ( sieve_plugin_module_find(path, name) == NULL ) {
- if ( i > 0 ) str_append_c(missing_modules, ' ');
-
- str_append(missing_modules, name);
- }
- }
-
- if ( str_len(missing_modules) > 0 ) {
- struct module *new_modules = module_dir_load
- (path, str_c(missing_modules), TRUE, SIEVE_VERSION);
-
- if ( sieve_modules == NULL ) {
- /* No modules loaded yet */
- sieve_modules = new_modules;
- } else {
- /* Find the end of the list */
- module = sieve_modules;
- while ( module != NULL && module->next != NULL )
- module = module->next;
-
- /* Add newly loaded modules */
- module->next = new_modules;
- }
+ /* Add newly loaded modules */
+ module->next = new_modules;
}
/* Call plugin load functions for this Sieve instance */
@@ -128,6 +106,13 @@
sieve_modules_refcount++;
}
+ module_names = t_strsplit_spaces(plugins, ", ");
+
+ for (i = 0; module_names[i] != NULL; i++) {
+ /* Allow giving the module names also in non-base form. */
+ module_names[i] = module_file_get_name(module_names[i]);
+ }
+
for (i = 0; module_names[i] != NULL; i++) {
struct sieve_plugin *plugin;
const char *name = module_names[i];
More information about the dovecot-cvs
mailing list