From 05a695af721cb8002f3d462c6952f45f0e9c5d9e Mon Sep 17 00:00:00 2001 From: Matt O'Gorman Date: Thu, 31 Aug 2006 21:00:20 +0000 Subject: everything that loads a config that needs a config file to run now reports AST_MODULE_LOAD_DECLINE when loading if config file is not there, also fixed an error in res_config_pgsql where it had a non static function when it should. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41633 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_queue.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'apps/app_queue.c') diff --git a/apps/app_queue.c b/apps/app_queue.c index 448e8ca74..878c67a4a 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3642,7 +3642,7 @@ static struct ast_custom_function queuememberlist_function = { .read = queue_function_queuememberlist, }; -static void reload_queues(void) +static int reload_queues(void) { struct call_queue *q; struct ast_config *cfg; @@ -3656,7 +3656,7 @@ static void reload_queues(void) if (!(cfg = ast_config_load("queues.conf"))) { ast_log(LOG_NOTICE, "No call queueing config file (queues.conf), so no call queues\n"); - return; + return 0; } memset(interface, 0, sizeof(interface)); AST_LIST_LOCK(&queues); @@ -3794,6 +3794,7 @@ static void reload_queues(void) } AST_LIST_TRAVERSE_SAFE_END; AST_LIST_UNLOCK(&queues); + return 1; } static int __queues_show(struct mansession *s, int manager, int fd, int argc, char **argv, int queue_show) @@ -4359,7 +4360,10 @@ static int unload_module(void) static int load_module(void) { int res; - + if(!reload_queues()) + return AST_MODULE_LOAD_DECLINE; + if (queue_persistent_members) + reload_queue_members(); res = ast_register_application(app, queue_exec, synopsis, descrip); res |= ast_cli_register(&cli_show_queue); res |= ast_cli_register(&cli_show_queues); @@ -4381,12 +4385,6 @@ static int load_module(void) res |= ast_custom_function_register(&queuewaitingcount_function); res |= ast_devstate_add(statechange_queue, NULL); - if (!res) { - reload_queues(); - if (queue_persistent_members) - reload_queue_members(); - } - return res; } -- cgit v1.2.3