]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
***BEHAVIOUR CHANGE*** reloadacl, load <module>, reload <module> will now explicitly...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 16 Sep 2010 22:38:06 +0000 (17:38 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 16 Sep 2010 22:38:06 +0000 (17:38 -0500)
src/include/switch_xml.h
src/mod/applications/mod_commands/mod_commands.c
src/switch_xml.c

index 220e65df02381841e8c16f5a56c565b78a07945f..9b0fbb44f38f508aa5124027f4110fd558fc200e 100644 (file)
@@ -331,6 +331,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(_In_ uint8_t reload, _Out_ con
 ///\return SWITCH_STATUS_SUCCESS if successful
 SWITCH_DECLARE(switch_status_t) switch_xml_init(_In_ switch_memory_pool_t *pool, _Out_ const char **err);
 
+SWITCH_DECLARE(switch_status_t) switch_xml_reload(const char **err);
 
 SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void);
 
index 0865b2b511c082dd788b11b836c85df875c18c97..d87e82047b96953626a51cf093ac39d543779dd5 100644 (file)
@@ -1179,17 +1179,18 @@ SWITCH_STANDARD_API(xml_locate_function)
 SWITCH_STANDARD_API(reload_acl_function)
 {
        const char *err;
-       switch_xml_t xml_root;
 
-       if (cmd && !strcmp(cmd, "reloadxml")) {
-               if ((xml_root = switch_xml_open_root(1, &err))) {
-                       switch_xml_free(xml_root);
-               }
+       if (cmd && !strcasecmp(cmd, "reloadxml")) {
+               stream->write_function(stream, "This option is depricated, we now always reloadxml.\n");
+       }
+       
+       if (switch_xml_reload(&err) == SWITCH_STATUS_SUCCESS) {
+               switch_load_network_lists(SWITCH_TRUE);
+               stream->write_function(stream, "+OK acl reloaded\n");
+       } else {
+               stream->write_function(stream, "-Error [%s]\n", err);
        }
 
-       switch_load_network_lists(SWITCH_TRUE);
-
-       stream->write_function(stream, "+OK acl reloaded\n");
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1738,6 +1739,10 @@ SWITCH_STANDARD_API(load_function)
                return SWITCH_STATUS_SUCCESS;
        }
 
+       if (switch_xml_reload(&err) == SWITCH_STATUS_SUCCESS) {
+               stream->write_function(stream, "+OK Reloading XML\n");
+       }
+
        if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) {
                stream->write_function(stream, "+OK\n");
        } else {
@@ -1832,6 +1837,10 @@ SWITCH_STANDARD_API(reload_function)
                stream->write_function(stream, "-ERR unloading module [%s]\n", err);
        }
 
+       if (switch_xml_reload(&err) == SWITCH_STATUS_SUCCESS) {
+               stream->write_function(stream, "+OK Reloading XML\n");
+       }
+
        if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) {
                stream->write_function(stream, "+OK module loaded\n");
        } else {
@@ -1843,13 +1852,9 @@ SWITCH_STANDARD_API(reload_function)
 
 SWITCH_STANDARD_API(reload_xml_function)
 {
-       const char *err;
-       switch_xml_t xml_root;
-
-       if ((xml_root = switch_xml_open_root(1, &err))) {
-               switch_xml_free(xml_root);
-       }
+       const char *err = "";
 
+       switch_xml_reload(&err);
        stream->write_function(stream, "+OK [%s]\n", err);
 
        return SWITCH_STATUS_SUCCESS;
@@ -4569,7 +4574,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
        SWITCH_ADD_API(commands_api_interface, "originate", "Originate a Call", originate_function, ORIGINATE_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "pause", "Pause", pause_function, PAUSE_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "regex", "Eval a regex", regex_function, "<data>|<pattern>[|<subst string>]");
-       SWITCH_ADD_API(commands_api_interface, "reloadacl", "Reload ACL", reload_acl_function, "[reloadxml]");
+       SWITCH_ADD_API(commands_api_interface, "reloadacl", "Reload ACL", reload_acl_function, "");
        SWITCH_ADD_API(commands_api_interface, "reload", "Reload Module", reload_function, UNLOAD_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "reloadxml", "Reload XML", reload_xml_function, "");
        SWITCH_ADD_API(commands_api_interface, "replace", "replace a string", replace_function, "<data>|<string1>|<string2>");
index efaede83fb7c997df848828275754205334d537d..688978907f19f1d959a8df7a8a92e3b023cffaa5 100644 (file)
@@ -2039,6 +2039,18 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e
        return r;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_xml_reload(const char **err)
+{
+       switch_xml_t xml_root;
+       
+       if ((xml_root = switch_xml_open_root(1, err))) {
+               switch_xml_free(xml_root);
+               return SWITCH_STATUS_SUCCESS;
+       }
+
+       return SWITCH_STATUS_GENERR;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, const char **err)
 {
        switch_xml_t xml;