[asterisk-commits] twilson: branch twilson/config_work r367121 - /team/twilson/config_work/apps/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun May 20 16:49:00 CDT 2012


Author: twilson
Date: Sun May 20 16:48:49 2012
New Revision: 367121

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=367121
Log:
Separate out options for general/sounds

Defaults would get set for general options after processing when we
hit the sounds category. Important for multiple global option categories
to have different types.

Modified:
    team/twilson/config_work/apps/app_skel.c

Modified: team/twilson/config_work/apps/app_skel.c
URL: http://svnview.digium.com/svn/asterisk/team/twilson/config_work/apps/app_skel.c?view=diff&rev=367121&r1=367120&r2=367121
==============================================================================
--- team/twilson/config_work/apps/app_skel.c (original)
+++ team/twilson/config_work/apps/app_skel.c Sun May 20 16:48:49 2012
@@ -185,12 +185,20 @@
  */
 static int skel_level_exists(struct ao2_container *tmp_container, const char *category);
 
-/*! \brief An aco_type structure to link the "general" and "sounds" categories to the skel_global_config type */
+/*! \brief An aco_type structure to link the "general" category to the skel_global_config type */
 static struct aco_type global_options = {
 	.type = ACO_GLOBAL,
 	.item_offset = offsetof(struct skel_config, global),
 	.category_match = ACO_WHITELIST,
-	.category = "general|sounds",
+	.category = "general",
+};
+
+/*! \brief An aco_type structure to link the "sounds" category to the skel_global_config type */
+static struct aco_type sound_options = {
+	.type = ACO_GLOBAL,
+	.item_offset = offsetof(struct skel_config, global),
+	.category_match = ACO_WHITELIST,
+	.category = "sounds",
 };
 
 /*! \brief An aco_type structure to link the everything but the "general" and "sounds" categories to the skel_level type */
@@ -211,7 +219,7 @@
 
 /*! \brief Register information about the configs being processed by this module */
 CONFIG_INFO_STANDARD(cfg_info, "app_skel.conf", globals, skel_config_alloc,
-	.types = ACO_TYPES(&global_options, &level_options),
+	.types = ACO_TYPES(&global_options, &sound_options, &level_options),
 );
 
 static void skel_global_config_destructor(void *obj)
@@ -640,14 +648,16 @@
 	}
 
 	/* Global options */
-	aco_option_register(&cfg_info, "prompt", &global_options, "please-enter-your&number&queue-less-than", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, prompt));
-	aco_option_register(&cfg_info, "wrong_guess", &global_options, "vm-pls-try-again", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, wrong));
-	aco_option_register(&cfg_info, "right_guess", &global_options, "auth-thankyou", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, right));
-	aco_option_register(&cfg_info, "too_high", &global_options, "high", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, high));
-	aco_option_register(&cfg_info, "too_low", &global_options, "low", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, low));
-	aco_option_register(&cfg_info, "lose", &global_options, "vm-goodbye", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, lose));
 	aco_option_register(&cfg_info, "games", &global_options, "3", OPT_UINT_T, 0, FLDSET(struct skel_global_config, num_games));
 	aco_option_register_custom(&cfg_info, "cheat", &global_options, "no", custom_bitfield_handler, 0);
+
+	/* Sound options */
+	aco_option_register(&cfg_info, "prompt", &sound_options, "please-enter-your&number&queue-less-than", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, prompt));
+	aco_option_register(&cfg_info, "wrong_guess", &sound_options, "vm-pls-try-again", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, wrong));
+	aco_option_register(&cfg_info, "right_guess", &sound_options, "auth-thankyou", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, right));
+	aco_option_register(&cfg_info, "too_high", &sound_options, "high", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, high));
+	aco_option_register(&cfg_info, "too_low", &sound_options, "low", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, low));
+	aco_option_register(&cfg_info, "lose", &sound_options, "vm-goodbye", OPT_STRINGFIELD_T, 0, STRFLDSET(struct skel_global_config, lose));
 
 	/* Level options */
 	aco_option_register(&cfg_info, "max_number", &level_options, NULL, OPT_UINT_T, 0, FLDSET(struct skel_level, max_num));




More information about the asterisk-commits mailing list