summaryrefslogtreecommitdiff
path: root/res/res_calendar_exchange.c
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2009-10-08 23:11:23 +0000
committerTerry Wilson <twilson@digium.com>2009-10-08 23:11:23 +0000
commita75ba8d1a9ed3a025416001fa2098ac7cfa613e8 (patch)
treea266eae42a3e68bdb0e012a81b5311264ddc92f8 /res/res_calendar_exchange.c
parent799e9962b63f0ce96099d51736bea87c99821ccd (diff)
Remove global variable that makes dlopen unhappy
This isn't the best way to do this, but it is the easiest. There are some limitations that are going to need to be addressed at some point with reloads and when I (or someone else) work on that, then the API can be updated to handle passing the private config data that the calendar tech modules need in a better way as well. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@223016 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_calendar_exchange.c')
-rw-r--r--res/res_calendar_exchange.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/res/res_calendar_exchange.c b/res/res_calendar_exchange.c
index 0b4e661e2..05a42633a 100644
--- a/res/res_calendar_exchange.c
+++ b/res/res_calendar_exchange.c
@@ -619,11 +619,12 @@ static int update_exchangecal(struct exchangecal_pvt *pvt)
static void *exchangecal_load_calendar(void *void_data)
{
struct exchangecal_pvt *pvt;
+ const struct ast_config *cfg;
struct ast_variable *v;
struct ast_calendar *cal = void_data;
ast_mutex_t refreshlock;
- if (!(cal && ast_calendar_config)) {
+ if (!(cal && (cfg = ast_calendar_config_acquire()))) {
ast_log(LOG_ERROR, "You must enable calendar support for res_exchangecal to load\n");
return NULL;
}
@@ -634,11 +635,13 @@ static void *exchangecal_load_calendar(void *void_data)
} else {
ast_log(LOG_WARNING, "Could not lock calendar, aborting!\n");
}
+ ast_calendar_config_release();
return NULL;
}
if (!(pvt = ao2_alloc(sizeof(*pvt), exchangecal_destructor))) {
ast_log(LOG_ERROR, "Could not allocate exchangecal_pvt structure for calendar: %s\n", cal->name);
+ ast_calendar_config_release();
return NULL;
}
@@ -648,6 +651,7 @@ static void *exchangecal_load_calendar(void *void_data)
ast_log(LOG_ERROR, "Could not allocate space for fetching events for calendar: %s\n", cal->name);
pvt = unref_exchangecal(pvt);
ao2_unlock(cal);
+ ast_calendar_config_release();
return NULL;
}
@@ -655,10 +659,11 @@ static void *exchangecal_load_calendar(void *void_data)
ast_log(LOG_ERROR, "Couldn't allocate string field space for calendar: %s\n", cal->name);
pvt = unref_exchangecal(pvt);
ao2_unlock(cal);
+ ast_calendar_config_release();
return NULL;
}
- for (v = ast_variable_browse(ast_calendar_config, cal->name); v; v = v->next) {
+ for (v = ast_variable_browse(cfg, cal->name); v; v = v->next) {
if (!strcasecmp(v->name, "url")) {
ast_string_field_set(pvt, url, v->value);
} else if (!strcasecmp(v->name, "user")) {
@@ -668,6 +673,8 @@ static void *exchangecal_load_calendar(void *void_data)
}
}
+ ast_calendar_config_release();
+
if (ast_strlen_zero(pvt->url)) {
ast_log(LOG_WARNING, "No URL was specified for Exchange calendar '%s' - skipping.\n", cal->name);
pvt = unref_exchangecal(pvt);