[asterisk-commits] mvanbaak: branch mvanbaak/res_clialiases_unconditional r151239 - /team/mvanba...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Oct 19 19:25:01 CDT 2008


Author: mvanbaak
Date: Sun Oct 19 19:25:01 2008
New Revision: 151239

URL: http://svn.digium.com/view/asterisk?view=rev&rev=151239
Log:
Dont check if the aliased command is actual a registered command.
This way we dont have to care about modules loaden after asterisk started
or whatever.
Came up with this idea after a discussion on #asterisk-dev with eliel and file.

Modified:
    team/mvanbaak/res_clialiases_unconditional/res/res_clialiases.c

Modified: team/mvanbaak/res_clialiases_unconditional/res/res_clialiases.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/res_clialiases_unconditional/res/res_clialiases.c?view=diff&rev=151239&r1=151238&r2=151239
==============================================================================
--- team/mvanbaak/res_clialiases_unconditional/res/res_clialiases.c (original)
+++ team/mvanbaak/res_clialiases_unconditional/res/res_clialiases.c Sun Oct 19 19:25:01 2008
@@ -221,16 +221,9 @@
 				alias->cli_entry.command = alias->alias;
 				alias->cli_entry.usage = "Aliased CLI Command";
 
-				/* Make sure the real command this alias points to really exists */
-				if (ast_cli_is_registered(alias->real_cmd)) {
-					ast_log(LOG_ERROR, "%s is not registered yet, skipping.\n", alias->real_cmd);
-				} else if (ast_cli_register(&alias->cli_entry)) {
-					ast_log(LOG_ERROR, "%s is already registered, skipping.\n", alias->real_cmd);
-				} else {
-					alias->registered = 1;
-					ao2_link(cli_aliases, alias);
-					ast_verbose(VERBOSE_PREFIX_2 "Aliased CLI command '%s' to '%s'\n", v1->name, v1->value);
-				}
+				alias->registered = 1;
+				ao2_link(cli_aliases, alias);
+				ast_verbose(VERBOSE_PREFIX_2 "Aliased CLI command '%s' to '%s'\n", v1->name, v1->value);
 				ao2_ref(alias, -1);
 			}
 		} else {
@@ -257,11 +250,6 @@
 	return 0;
 }
 
-static void clialiases_atloaded(void)
-{
-	load_config(0);
-}
-
 /*! \brief Function called to unload the module */
 static int unload_module(void)
 {
@@ -282,7 +270,6 @@
 	load_config(0);
 
 	ast_cli_register_multiple(cli_alias, sizeof(cli_alias) / sizeof(struct ast_cli_entry));
-	ast_register_atstart(clialiases_atloaded);
 
 	return AST_MODULE_LOAD_SUCCESS;
 }




More information about the asterisk-commits mailing list