From: Timo Sirainen Date: Wed, 15 Oct 2014 14:37:05 +0000 (-0700) Subject: doveconf: Allow settings plugins to print comments to the output header. X-Git-Tag: 2.2.15~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fcf9b577a74f18aa0fe4500cb192c1b1d350d38;p=thirdparty%2Fdovecot%2Fcore.git doveconf: Allow settings plugins to print comments to the output header. If plugin contains _doveconf_comment string, it's written as part of the doveconf output. The idea mainly being that the major plugins (such as Pigeonhole) could print their version number there to avoid having to ask for it separately. --- diff --git a/src/config/doveconf.c b/src/config/doveconf.c index 8596e5cea0..7f16eec9b1 100644 --- a/src/config/doveconf.c +++ b/src/config/doveconf.c @@ -707,6 +707,7 @@ int main(int argc, char *argv[]) bool config_path_specified, expand_vars = FALSE, hide_key = FALSE; bool parse_full_config = FALSE, simple_output = FALSE; bool dump_defaults = FALSE, host_verify = FALSE; + bool print_plugin_comment = FALSE; if (getenv("USE_SYSEXITS") != NULL) { /* we're coming from (e.g.) LDA */ @@ -787,11 +788,23 @@ int main(int argc, char *argv[]) /* print the config file path before parsing it, so in case of errors it's still shown */ printf("# "DOVECOT_VERSION_FULL": %s\n", config_path); + print_plugin_comment = TRUE; fflush(stdout); } master_service_init_finish(master_service); config_parse_load_modules(); + if (print_plugin_comment) { + struct module *m; + + for (m = modules; m != NULL; m = m->next) { + const char **str = module_get_symbol_quiet(m, + t_strdup_printf("%s_doveconf_comment", m->name)); + if (str != NULL) + printf("# %s\n", *str); + } + } + if ((ret = config_parse_file(dump_defaults ? NULL : config_path, expand_vars, parse_full_config ? NULL : wanted_modules,