diff options
author | mogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-31 21:00:20 +0000 |
---|---|---|
committer | mogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-31 21:00:20 +0000 |
commit | 73925ee14a02afb50f6c0aea3cc4e54f99493440 (patch) | |
tree | 5eac7fd790352b502dbbc4fc21ae517fe7c388ad /res/res_jabber.c | |
parent | 43c75db33e757e08cdec37b1713a0e275d9a039b (diff) |
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: http://svn.digium.com/svn/asterisk/trunk@41633 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_jabber.c')
-rw-r--r-- | res/res_jabber.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/res/res_jabber.c b/res/res_jabber.c index ed6d37321..0a98d2693 100644 --- a/res/res_jabber.c +++ b/res/res_jabber.c @@ -80,7 +80,7 @@ static int aji_show_clients(int fd, int argc, char *argv[]); static int aji_create_client(char *label, struct ast_variable *var, int debug); static int aji_create_buddy(char *label, struct aji_client *client); static int aji_create_transport(char *label, struct aji_client *client); -static void aji_reload(void); +static int aji_reload(void); static int aji_load_config(void); static void aji_pruneregister(struct aji_client *client); static int aji_register_transport(void *data, ikspak *pak); @@ -2263,23 +2263,25 @@ static int manager_jabber_send( struct mansession *s, struct message *m ) } -static void aji_reload() +static int aji_reload() { ASTOBJ_CONTAINER_MARKALL(&clients); - if (!aji_load_config()) + if (!aji_load_config()) { ast_log(LOG_ERROR, "JABBER: Failed to load config.\n"); - else { - ASTOBJ_CONTAINER_PRUNE_MARKED(&clients, aji_client_destroy); - ASTOBJ_CONTAINER_TRAVERSE(&clients, 1, { - ASTOBJ_RDLOCK(iterator); - if(iterator->state == AJI_DISCONNECTED) { - if (!iterator->thread) - ast_pthread_create(&iterator->thread, NULL, aji_recv_loop, iterator); - } else if (iterator->state == AJI_CONNECTING) - aji_get_roster(iterator); - ASTOBJ_UNLOCK(iterator); - }); + return 0; } + ASTOBJ_CONTAINER_PRUNE_MARKED(&clients, aji_client_destroy); + ASTOBJ_CONTAINER_TRAVERSE(&clients, 1, { + ASTOBJ_RDLOCK(iterator); + if(iterator->state == AJI_DISCONNECTED) { + if (!iterator->thread) + ast_pthread_create(&iterator->thread, NULL, aji_recv_loop, iterator); + } else if (iterator->state == AJI_CONNECTING) + aji_get_roster(iterator); + ASTOBJ_UNLOCK(iterator); + }); + + return 1; } static int unload_module(void) @@ -2307,7 +2309,8 @@ static int unload_module(void) static int load_module(void) { ASTOBJ_CONTAINER_INIT(&clients); - aji_reload(); + if(!aji_reload()) + return AST_MODULE_LOAD_DECLINE; ast_manager_register2("JabberSend", EVENT_FLAG_SYSTEM, manager_jabber_send, "Sends a message to a Jabber Client", mandescr_jabber_send); ast_register_application(app_ajisend, aji_send_exec, ajisend_synopsis, ajisend_descrip); |