]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveconf: Allow settings plugins to print comments to the output header.
authorTimo Sirainen <tss@iki.fi>
Wed, 15 Oct 2014 14:37:05 +0000 (07:37 -0700)
committerTimo Sirainen <tss@iki.fi>
Wed, 15 Oct 2014 14:37:05 +0000 (07:37 -0700)
If plugin contains <plugin name>_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.

src/config/doveconf.c

index 8596e5cea074fb6b26885e64329a7a440ef25442..7f16eec9b128dd5dab346c263b8b4f15113b00b2 100644 (file)
@@ -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,