]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
config: inform config hook of change when writing file
authorScott Griepentrog <sgriepentrog@digium.com>
Fri, 11 Jul 2014 16:37:04 +0000 (16:37 +0000)
committerScott Griepentrog <sgriepentrog@digium.com>
Fri, 11 Jul 2014 16:37:04 +0000 (16:37 +0000)
When updated configuration is written back to the conf
file - for example when a user changes their voicemail
pin, make sure that any config hook that wants to know
of changes is informed.

Review: https://reviewboard.asterisk.org/r/3708/

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.15@418367 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/config.c

index b34730ce17e50b95460a95d00b9fd9063d56b15f..75cee6d9313fe96257d60dd4f59e84b25f8fb7e0 100644 (file)
@@ -70,7 +70,7 @@ static char *extconfig_conf = "extconfig.conf";
 
 
 static struct ao2_container *cfg_hooks;
-static void config_hook_exec(const char *filename, const char *module, struct ast_config *cfg);
+static void config_hook_exec(const char *filename, const char *module, const struct ast_config *cfg);
 
 /*! \brief Structure to keep comments for rewriting configuration files */
 struct ast_comment {
@@ -2134,6 +2134,9 @@ int ast_config_text_file_save(const char *configfile, const struct ast_config *c
        }
        ao2_ref(fileset, -1); /* this should destroy the hash container */
 
+       /* pass new configuration to any config hooks */
+       config_hook_exec(configfile, generator, cfg);
+
        return 0;
 }
 
@@ -3093,7 +3096,7 @@ void ast_config_hook_unregister(const char *name)
        ao2_find(cfg_hooks, &tmp, OBJ_POINTER | OBJ_UNLINK | OBJ_NODATA);
 }
 
-static void config_hook_exec(const char *filename, const char *module, struct ast_config *cfg)
+static void config_hook_exec(const char *filename, const char *module, const struct ast_config *cfg)
 {
        struct ao2_iterator it;
        struct cfg_hook *hook;