[svn-commits] twilson: branch twilson/calendaring r182407 - in /team/twilson/calendaring: m...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 16 20:04:58 CDT 2009


Author: twilson
Date: Mon Mar 16 20:04:54 2009
New Revision: 182407

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=182407
Log:
Address russell's comments on reviewboard (except xmldocs)

Modified:
    team/twilson/calendaring/main/calendar.c
    team/twilson/calendaring/res/res_caldav.c
    team/twilson/calendaring/res/res_exchangecal.c
    team/twilson/calendaring/res/res_icalendar.c

Modified: team/twilson/calendaring/main/calendar.c
URL: http://svn.digium.com/svn-view/asterisk/team/twilson/calendaring/main/calendar.c?view=diff&rev=182407&r1=182406&r2=182407
==============================================================================
--- team/twilson/calendaring/main/calendar.c (original)
+++ team/twilson/calendaring/main/calendar.c Mon Mar 16 20:04:54 2009
@@ -46,6 +46,7 @@
 static pthread_t refresh_thread = AST_PTHREADT_NULL;
 static ast_mutex_t refreshlock;
 static ast_cond_t refresh_condition;
+static ast_mutex_t reloadlock;
 
 static void event_notification_destroy(void *data);
 static void *event_notification_duplicate(void *data);
@@ -735,7 +736,7 @@
 				ast_debug(1, "Disabling calendar support\n");
 				ast_config_destroy(calendar_config);
 				calendar_config = NULL;
-				return 0;
+				return -1;
 			} else {
 				ast_debug(1, "Enabling calendar support\n");
 			}
@@ -1394,6 +1395,8 @@
 {
 	struct ast_calendar_tech *iter;
 
+	ast_mutex_lock(&reloadlock);
+
 	/* Mark existing calendars for deletion */
 	ao2_callback(calendars, OBJ_NODATA | OBJ_MULTIPLE, cb_pending_deletion, NULL);
 	load_config(NULL);
@@ -1409,6 +1412,8 @@
 	/* Delete calendars that no longer show up in the config */
 	ao2_callback(calendars, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, cb_rm_pending_deletion, NULL);
 
+	ast_mutex_unlock(&reloadlock);
+
 	return 0;
 }
 
@@ -1438,9 +1443,27 @@
 
 int ast_calendar_init()
 {
+	if (load_config(NULL)) {
+		/* We don't have calendar support enabled */
+		return 0;
+	}
+
 	if (!(calendars = ao2_container_alloc(MAX_BUCKETS, calendar_hash_fn, calendar_cmp_fn))) {
 		ast_log(LOG_ERROR, "Unable to allocate calendars container!\n");
 		return -1;
+	}
+
+	ast_mutex_init(&refreshlock);
+	ast_cond_init(&refresh_condition, NULL);
+	ast_mutex_init(&reloadlock);
+
+	if (!(sched = sched_context_create())) {
+		ast_log(LOG_ERROR, "Unable to create sched context\n");
+		return -1;
+	}
+
+	if (ast_pthread_create_background(&refresh_thread, NULL, do_refresh, NULL) < 0) {
+		ast_log(LOG_ERROR, "Unable to start refresh thread--notifications disabled!\n");
 	}
 
 	__ast_custom_function_register(&calendar_busy_function, NULL);
@@ -1450,20 +1473,7 @@
 	__ast_custom_function_register(&calendar_write_function, NULL);
 	ast_cli_register_multiple(calendar_cli, ARRAY_LEN(calendar_cli));
 
-	ast_mutex_init(&refreshlock);
-	ast_cond_init(&refresh_condition, NULL);
-
-	if (!(sched = sched_context_create())) {
-		ast_log(LOG_ERROR, "Unable to create sched context\n");
-		return -1;
-	}
-
-	if (ast_pthread_create_background(&refresh_thread, NULL, do_refresh, NULL) < 0) {
-		ast_log(LOG_ERROR, "Unable to start refresh thread--notifications disabled!\n");
-	}
-
 	ast_devstate_prov_add("Calendar", calendarstate);
 
-	load_config(NULL);
 	return 0;
 }

Modified: team/twilson/calendaring/res/res_caldav.c
URL: http://svn.digium.com/svn-view/asterisk/team/twilson/calendaring/res/res_caldav.c?view=diff&rev=182407&r1=182406&r2=182407
==============================================================================
--- team/twilson/calendaring/res/res_caldav.c (original)
+++ team/twilson/calendaring/res/res_caldav.c Mon Mar 16 20:04:54 2009
@@ -636,7 +636,7 @@
 	return 0;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Asterisk MS Exchange Calendar Integration",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk MS Exchange Calendar Integration",
 		.load = load_module,
 		.unload = unload_module,
 	);

Modified: team/twilson/calendaring/res/res_exchangecal.c
URL: http://svn.digium.com/svn-view/asterisk/team/twilson/calendaring/res/res_exchangecal.c?view=diff&rev=182407&r1=182406&r2=182407
==============================================================================
--- team/twilson/calendaring/res/res_exchangecal.c (original)
+++ team/twilson/calendaring/res/res_exchangecal.c Mon Mar 16 20:04:54 2009
@@ -81,9 +81,11 @@
 	struct xmlstate *state = data;
 	char *tmp;
 
-	tmp = strchr(name, ':');
-	if (tmp)
+	if ((tmp = strchr(name, ':'))) {
 		tmp++;
+	} else {
+		return IKS_HOOK;
+	}
 
 	ast_copy_string(state->tag, tmp, sizeof(state->tag));
 
@@ -740,7 +742,7 @@
 	return 0;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Asterisk MS Exchange Calendar Integration",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk MS Exchange Calendar Integration",
 		.load = load_module,
 		.unload = unload_module,
 	);

Modified: team/twilson/calendaring/res/res_icalendar.c
URL: http://svn.digium.com/svn-view/asterisk/team/twilson/calendaring/res/res_icalendar.c?view=diff&rev=182407&r1=182406&r2=182407
==============================================================================
--- team/twilson/calendaring/res/res_icalendar.c (original)
+++ team/twilson/calendaring/res/res_icalendar.c Mon Mar 16 20:04:54 2009
@@ -439,7 +439,7 @@
 	return 0;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Asterisk iCalendar .ics file integration",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk iCalendar .ics file integration",
 		.load = load_module,
 		.unload = unload_module,
 	);




More information about the svn-commits mailing list