diff --git a/src/lib-sieve/plugins/include/ext-include-binary.c b/src/lib-sieve/plugins/include/ext-include-binary.c index 966ba3a8c2cbfd89be534f10d33aa5f06a7859dd..3711c30ff33db18a10afd6e4cb9f782828ef5777 100644 --- a/src/lib-sieve/plugins/include/ext-include-binary.c +++ b/src/lib-sieve/plugins/include/ext-include-binary.c @@ -340,9 +340,11 @@ static bool ext_include_binary_open if ( (flags & EXT_INCLUDE_FLAG_OPTIONAL) == 0 ) { /* Not supposed to be missing, recompile */ if ( svinst->debug ) { - sieve_sys_debug(svinst, - "include: script '%s' included in binary %s is missing, " - "so recompile", str_c(script_name), sieve_binary_path(sbin)); + e_debug(svinst->event, "include: " + "script '%s' included in binary %s is missing, " + "so recompile", + str_c(script_name), + sieve_binary_path(sbin)); } return FALSE; } @@ -352,8 +354,8 @@ static bool ext_include_binary_open * what. */ if ( svinst->debug ) { - sieve_sys_debug(svinst, - "include: script '%s' is missing in binary %s, but is now available, " + e_debug(svinst->event, "include: " + "script '%s' is missing in binary %s, but is now available, " "so recompile", str_c(script_name), sieve_binary_path(sbin)); } sieve_script_unref(&script); diff --git a/src/lib-sieve/plugins/include/ext-include-common.c b/src/lib-sieve/plugins/include/ext-include-common.c index b0e86975da31aa2c80a98ef7e3a91c3afdded4be..212b314068f4a08e08e2e906febd342471ab059b 100644 --- a/src/lib-sieve/plugins/include/ext-include-common.c +++ b/src/lib-sieve/plugins/include/ext-include-common.c @@ -90,8 +90,9 @@ bool ext_include_load if ( location == NULL ) location = sieve_setting_get(svinst, "sieve_global_dir"); - if ( location == NULL && svinst->debug ) { - sieve_sys_debug(svinst, "include: sieve_global is not set; " + if (location == NULL) { + e_debug(svinst->event, "include: " + "sieve_global is not set; " "it is currently not possible to include `:global' scripts."); } diff --git a/src/lib-sieve/sieve-script.c b/src/lib-sieve/sieve-script.c index b7ee19b3850cf955fc6811b5399a3fe103e2b910..8df9db5681c7e6e21e34ddfb080f08d9fddd9b8c 100644 --- a/src/lib-sieve/sieve-script.c +++ b/src/lib-sieve/sieve-script.c @@ -821,11 +821,8 @@ void sieve_script_sys_debug(struct sieve_script *script, const char *fmt, ...) struct sieve_instance *svinst = script->storage->svinst; va_list va; - if (!svinst->debug) - return; - va_start(va, fmt); - sieve_sys_debug(svinst, "%s script: %s", + e_debug(svinst->event, "%s script: %s", script->driver_name, t_strdup_vprintf(fmt, va)); va_end(va); } diff --git a/src/lib-sieve/sieve-storage.c b/src/lib-sieve/sieve-storage.c index 720f68167c23e5dad0a7642204f27bdf52f08e49..0cbe8fcc8a1b9755f20cdf6a0ea70f3cdf4141ba 100644 --- a/src/lib-sieve/sieve-storage.c +++ b/src/lib-sieve/sieve-storage.c @@ -311,8 +311,8 @@ sieve_storage_init(struct sieve_instance *svinst, event = sieve_storage_event_create(svinst, storage_class); if ((flags & SIEVE_STORAGE_FLAG_SYNCHRONIZING) != 0 && - !storage_class->allows_synchronization ) { - sieve_sys_debug(svinst, "%s storage: " + !storage_class->allows_synchronization) { + e_debug(svinst->event, "%s storage: " "Storage does not support synchronization", storage_class->driver_name); *error_r = SIEVE_ERROR_NOT_POSSIBLE; @@ -409,10 +409,8 @@ sieve_storage_do_create_main(struct sieve_instance *svinst, if (set_sieve != NULL) { if (*set_sieve == '\0') { /* disabled */ - if (debug) { - sieve_sys_debug(svinst, "storage: " - "Personal storage is disabled (sieve=\"\")"); - } + e_debug(svinst->event, "storage: " + "Personal storage is disabled (sieve=\"\")"); *error_r = SIEVE_ERROR_NOT_FOUND; return NULL; } @@ -516,7 +514,6 @@ sieve_storage_create_main(struct sieve_instance *svinst, struct mail_user *user, { struct sieve_storage *storage; const char *set_enabled, *set_default, *set_default_name; - bool debug = svinst->debug; enum sieve_error error; if (error_r != NULL) @@ -527,10 +524,8 @@ sieve_storage_create_main(struct sieve_instance *svinst, struct mail_user *user, /* Check whether Sieve is disabled for this user */ if ((set_enabled = sieve_setting_get(svinst, "sieve_enabled")) != NULL && strcasecmp(set_enabled, "no") == 0) { - if (debug) { - sieve_sys_debug(svinst, - "Sieve is disabled for this user"); - } + e_debug(svinst->event, + "Sieve is disabled for this user"); *error_r = SIEVE_ERROR_NOT_POSSIBLE; return NULL; } @@ -574,27 +569,21 @@ sieve_storage_create_main(struct sieve_instance *svinst, struct mail_user *user, /* Failed; try using default script location (not for temporary failures, read/write access, or dsync) */ if (set_default == NULL) { - if (debug) { - sieve_sys_debug(svinst, "storage: " - "No default script location configured"); - } + e_debug(svinst->event, "storage: " + "No default script location configured"); } else { - if (debug) { - sieve_sys_debug(svinst, "storage: " - "Trying default script location `%s'", - set_default); - } + e_debug(svinst->event, "storage: " + "Trying default script location `%s'", + set_default); storage = sieve_storage_create(svinst, set_default, 0, error_r); if (storage == NULL) { switch (*error_r) { case SIEVE_ERROR_NOT_FOUND: - if (debug) { - sieve_sys_debug(svinst, "storage: " - "Default script location `%s' not found", - set_default); - } + e_debug(svinst->event, "storage: " + "Default script location `%s' not found", + set_default); break; case SIEVE_ERROR_TEMP_FAILURE: e_error(svinst->event, "storage: " @@ -1483,7 +1472,7 @@ void sieve_storage_sys_debug(struct sieve_storage *storage, return; va_start(va, fmt); - sieve_sys_debug(svinst, "%s storage: %s", + e_debug(svinst->event, "%s storage: %s", storage->driver_name, t_strdup_vprintf(fmt, va)); va_end(va); } diff --git a/src/lib-sieve/sieve.c b/src/lib-sieve/sieve.c index e76eecb597e188156d5dbbbbf00fb2d8fdc28934..647dd9a9f8e8e486c2e682f6dc8f87d0ebb39200 100644 --- a/src/lib-sieve/sieve.c +++ b/src/lib-sieve/sieve.c @@ -100,10 +100,8 @@ struct sieve_instance *sieve_init(const struct sieve_environment *env, sieve_errors_init(svinst); - if (debug) { - sieve_sys_debug(svinst, "%s version %s initializing", - PIGEONHOLE_NAME, PIGEONHOLE_VERSION_FULL); - } + e_debug(svinst->event, "%s version %s initializing", + PIGEONHOLE_NAME, PIGEONHOLE_VERSION_FULL); /* Read configuration */ @@ -320,11 +318,11 @@ struct sieve_binary *sieve_compile(struct sieve_instance *svinst, sbin = sieve_compile_script(script, ehandler, flags, error_r); - if (svinst->debug && sbin != NULL) { - sieve_sys_debug(svinst, - "Script `%s' from %s successfully compiled", - sieve_script_name(script), - sieve_script_location(script)); + if (sbin != NULL) { + e_debug(svinst->event, + "Script `%s' from %s successfully compiled", + sieve_script_name(script), + sieve_script_location(script)); } sieve_script_unref(&script); @@ -395,11 +393,9 @@ struct sieve_binary *sieve_open_script(struct sieve_script *script, /* Ok, it exists; now let's see if it is up to date */ if (!sieve_binary_up_to_date(sbin, flags)) { /* Not up to date */ - if (svinst->debug) { - sieve_sys_debug(svinst, - "Script binary %s is not up-to-date", - sieve_binary_path(sbin)); - } + e_debug(svinst->event, + "Script binary %s is not up-to-date", + sieve_binary_path(sbin)); sieve_binary_unref(&sbin); sbin = NULL; @@ -410,22 +406,18 @@ struct sieve_binary *sieve_open_script(struct sieve_script *script, * to (re-)compile. */ if (sbin != NULL) { - if (svinst->debug) { - sieve_sys_debug(svinst, - "Script binary %s successfully loaded", - sieve_binary_path(sbin)); - } - + e_debug(svinst->event, + "Script binary %s successfully loaded", + sieve_binary_path(sbin)); } else { - sbin = sieve_compile_script(script, ehandler, flags, error_r); + sbin = sieve_compile_script(script, ehandler, + flags, error_r); if (sbin != NULL) { - if (svinst->debug) { - sieve_sys_debug(svinst, - "Script `%s' from %s successfully compiled", - sieve_script_name(script), - sieve_script_location(script)); - } + e_debug(svinst->event, + "Script `%s' from %s successfully compiled", + sieve_script_name(script), + sieve_script_location(script)); } } } T_END; diff --git a/src/lib-sieve/storage/ldap/sieve-ldap-storage.c b/src/lib-sieve/storage/ldap/sieve-ldap-storage.c index 026b05c9a73bfd411169e627b8d5136807c06378..2e9a160ab1d466b83dc5bff8252412a209d446e4 100644 --- a/src/lib-sieve/storage/ldap/sieve-ldap-storage.c +++ b/src/lib-sieve/storage/ldap/sieve-ldap-storage.c @@ -199,11 +199,9 @@ void sieve_storage_ldap_plugin_load sieve_storage_class_register (svinst, &sieve_ldap_storage_plugin); - if ( svinst->debug ) { - sieve_sys_debug(svinst, - "Sieve LDAP storage plugin for %s version %s loaded", - PIGEONHOLE_NAME, PIGEONHOLE_VERSION_FULL); - } + e_debug(svinst->event, + "Sieve LDAP storage plugin for %s version %s loaded", + PIGEONHOLE_NAME, PIGEONHOLE_VERSION_FULL); } void sieve_storage_ldap_plugin_unload diff --git a/src/plugins/sieve-extprograms/sieve-extprograms-common.c b/src/plugins/sieve-extprograms/sieve-extprograms-common.c index 82d8a387b40f26ac1fdb5cd9e7fb7a33cfa1244f..2da3ab1839f14f0ed6dbd8b8b652081dd085b1ff 100644 --- a/src/plugins/sieve-extprograms/sieve-extprograms-common.c +++ b/src/plugins/sieve-extprograms/sieve-extprograms-common.c @@ -81,12 +81,10 @@ struct sieve_extprograms_config *sieve_extprograms_config_init SIEVE_EXTPROGRAMS_DEFAULT_EXEC_TIMEOUT_SECS; if ( bin_dir == NULL && socket_dir == NULL ) { - if ( svinst->debug ) { - sieve_sys_debug(svinst, "%s extension: " - "no bin or socket directory specified; extension is unconfigured " - "(both sieve_%s_bin_dir and sieve_%s_socket_dir are not set)", - sieve_extension_name(ext), extname, extname); - } + e_debug(svinst->event, "%s extension: " + "no bin or socket directory specified; extension is unconfigured " + "(both sieve_%s_bin_dir and sieve_%s_socket_dir are not set)", + sieve_extension_name(ext), extname, extname); } else { ext_config->bin_dir = i_strdup(bin_dir); ext_config->socket_dir = i_strdup(socket_dir); @@ -422,10 +420,8 @@ struct sieve_extprogram *sieve_extprogram_create bool fork = FALSE; int ret; - if ( svinst->debug ) { - sieve_sys_debug(svinst, "action %s: " - "running program: %s", action, program_name); - } + e_debug(svinst->event, "action %s: " + "running program: %s", action, program_name); if ( ext_config == NULL || (ext_config->bin_dir == NULL && ext_config->socket_dir == NULL) ) { @@ -444,11 +440,9 @@ struct sieve_extprogram *sieve_extprogram_create if ( (ret=stat(path, &st)) < 0 ) { switch ( errno ) { case ENOENT: - if ( svinst->debug ) { - sieve_sys_debug(svinst, "action %s: " - "socket path `%s' for program `%s' not found", - action, path, program_name); - } + e_debug(svinst->event, "action %s: " + "socket path `%s' for program `%s' not found", + action, path, program_name); break; case EACCES: e_error(svinst->event, "action %s: " @@ -480,11 +474,9 @@ struct sieve_extprogram *sieve_extprogram_create if ( (ret=stat(path, &st)) < 0 ) { switch ( errno ) { case ENOENT: - if ( svinst->debug ) { - sieve_sys_debug(svinst, "action %s: " - "executable path `%s' for program `%s' not found", - action, path, program_name); - } + e_debug(svinst->event, "action %s: " + "executable path `%s' for program `%s' not found", + action, path, program_name); *error_r = SIEVE_ERROR_NOT_FOUND; break; case EACCES: diff --git a/src/plugins/sieve-extprograms/sieve-extprograms-plugin.c b/src/plugins/sieve-extprograms/sieve-extprograms-plugin.c index 6847a832d48230aee5ca3fc7d761482005155a35..bf17a80b375a18c3d970ba43bf4bb6438fd01553 100644 --- a/src/plugins/sieve-extprograms/sieve-extprograms-plugin.c +++ b/src/plugins/sieve-extprograms/sieve-extprograms-plugin.c @@ -33,7 +33,8 @@ void sieve_extprograms_plugin_load (svinst, &sieve_ext_vnd_execute, FALSE); if ( svinst->debug ) { - sieve_sys_debug(svinst, "Sieve Extprograms plugin for %s version %s loaded", + e_debug(svinst->event, + "Sieve Extprograms plugin for %s version %s loaded", PIGEONHOLE_NAME, PIGEONHOLE_VERSION_FULL); }