Revert unnecessary indications API change from rev 122314

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@168561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2009-01-13 19:13:05 +00:00
parent 1dc0a2d811
commit 9161b7fc87
11 changed files with 72 additions and 72 deletions

View File

@@ -329,21 +329,21 @@ void ast_playtones_stop(struct ast_channel *chan)
/*--------------------------------------------*/
static struct ind_tone_zone *ind_tone_zones;
static struct ind_tone_zone *current_tonezone;
static struct tone_zone *tone_zones;
static struct tone_zone *current_tonezone;
/* Protect the ind_tone_zones list (highly unlikely that two things would change
/* Protect the tone_zones list (highly unlikely that two things would change
* it at the same time, but still! */
AST_MUTEX_DEFINE_STATIC(tzlock);
struct ind_tone_zone *ast_walk_indications(const struct ind_tone_zone *cur)
struct tone_zone *ast_walk_indications(const struct tone_zone *cur)
{
struct ind_tone_zone *tz;
struct tone_zone *tz;
if (cur == NULL)
return ind_tone_zones;
return tone_zones;
ast_mutex_lock(&tzlock);
for (tz = ind_tone_zones; tz; tz = tz->next)
for (tz = tone_zones; tz; tz = tz->next)
if (tz == cur)
break;
if (tz)
@@ -356,7 +356,7 @@ struct ind_tone_zone *ast_walk_indications(const struct ind_tone_zone *cur)
int ast_set_indication_country(const char *country)
{
if (country) {
struct ind_tone_zone *z = ast_get_indication_zone(country);
struct tone_zone *z = ast_get_indication_zone(country);
if (z) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Setting default indication country to '%s'\n",country);
@@ -367,22 +367,22 @@ int ast_set_indication_country(const char *country)
return 1; /* not found */
}
/* locate ind_tone_zone, given the country. if country == NULL, use the default country */
struct ind_tone_zone *ast_get_indication_zone(const char *country)
/* locate tone_zone, given the country. if country == NULL, use the default country */
struct tone_zone *ast_get_indication_zone(const char *country)
{
struct ind_tone_zone *tz;
struct tone_zone *tz;
int alias_loop = 0;
if (ast_strlen_zero(country)) {
/* No country specified? Return the default or the first in the list */
return current_tonezone ? current_tonezone : ind_tone_zones;
return current_tonezone ? current_tonezone : tone_zones;
}
ast_mutex_lock(&tzlock);
do {
for (tz=ind_tone_zones; tz; tz=tz->next) {
for (tz=tone_zones; tz; tz=tz->next) {
if (strcasecmp(country,tz->country)==0) {
/* ind_tone_zone found */
/* tone_zone found */
if (tz->alias && tz->alias[0]) {
country = tz->alias;
break;
@@ -399,16 +399,16 @@ struct ind_tone_zone *ast_get_indication_zone(const char *country)
return 0;
}
/* locate a ind_tone_zone_sound, given the ind_tone_zone. if ind_tone_zone == NULL, use the default ind_tone_zone */
struct ind_tone_zone_sound *ast_get_indication_tone(const struct ind_tone_zone *zone, const char *indication)
/* locate a tone_zone_sound, given the tone_zone. if tone_zone == NULL, use the default tone_zone */
struct tone_zone_sound *ast_get_indication_tone(const struct tone_zone *zone, const char *indication)
{
struct ind_tone_zone_sound *ts;
struct tone_zone_sound *ts;
/* we need some tonezone, pick the first */
if (zone == NULL && current_tonezone)
zone = current_tonezone; /* default country? */
if (zone == NULL && ind_tone_zones)
zone = ind_tone_zones; /* any country? */
if (zone == NULL && tone_zones)
zone = tone_zones; /* any country? */
if (zone == NULL)
return 0; /* not a single country insight */
@@ -425,11 +425,11 @@ struct ind_tone_zone_sound *ast_get_indication_tone(const struct ind_tone_zone *
return 0;
}
/* helper function to delete a ind_tone_zone in its entirety */
static inline void free_zone(struct ind_tone_zone* zone)
/* helper function to delete a tone_zone in its entirety */
static inline void free_zone(struct tone_zone* zone)
{
while (zone->tones) {
struct ind_tone_zone_sound *tmp = zone->tones->next;
struct tone_zone_sound *tmp = zone->tones->next;
free((void*)zone->tones->name);
free((void*)zone->tones->data);
free(zone->tones);
@@ -443,19 +443,19 @@ static inline void free_zone(struct ind_tone_zone* zone)
/*--------------------------------------------*/
/* add a new country, if country exists, it will be replaced. */
int ast_register_indication_country(struct ind_tone_zone *zone)
int ast_register_indication_country(struct tone_zone *zone)
{
struct ind_tone_zone *tz,*pz;
struct tone_zone *tz,*pz;
ast_mutex_lock(&tzlock);
for (pz=NULL,tz=ind_tone_zones; tz; pz=tz,tz=tz->next) {
for (pz=NULL,tz=tone_zones; tz; pz=tz,tz=tz->next) {
if (strcasecmp(zone->country,tz->country)==0) {
/* ind_tone_zone already there, replace */
/* tone_zone already there, replace */
zone->next = tz->next;
if (pz)
pz->next = zone;
else
ind_tone_zones = zone;
tone_zones = zone;
/* if we are replacing the default zone, re-point it */
if (tz == current_tonezone)
current_tonezone = zone;
@@ -470,7 +470,7 @@ int ast_register_indication_country(struct ind_tone_zone *zone)
if (pz)
pz->next = zone;
else
ind_tone_zones = zone;
tone_zones = zone;
ast_mutex_unlock(&tzlock);
if (option_verbose > 2)
@@ -482,21 +482,21 @@ int ast_register_indication_country(struct ind_tone_zone *zone)
* Also, all countries which are an alias for the specified country are removed. */
int ast_unregister_indication_country(const char *country)
{
struct ind_tone_zone *tz, *pz = NULL, *tmp;
struct tone_zone *tz, *pz = NULL, *tmp;
int res = -1;
ast_mutex_lock(&tzlock);
tz = ind_tone_zones;
tz = tone_zones;
while (tz) {
if (country==NULL ||
(strcasecmp(country, tz->country)==0 ||
strcasecmp(country, tz->alias)==0)) {
/* ind_tone_zone found, remove */
/* tone_zone found, remove */
tmp = tz->next;
if (pz)
pz->next = tmp;
else
ind_tone_zones = tmp;
tone_zones = tmp;
/* if we are unregistering the default country, w'll notice */
if (tz == current_tonezone) {
ast_log(LOG_NOTICE,"Removed default indication country '%s'\n",tz->country);
@@ -505,8 +505,8 @@ int ast_unregister_indication_country(const char *country)
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Unregistered indication country '%s'\n",tz->country);
free_zone(tz);
if (ind_tone_zones == tz)
ind_tone_zones = tmp;
if (tone_zones == tz)
tone_zones = tmp;
tz = tmp;
res = 0;
}
@@ -520,11 +520,11 @@ int ast_unregister_indication_country(const char *country)
return res;
}
/* add a new indication to a ind_tone_zone. ind_tone_zone must exist. if the indication already
/* add a new indication to a tone_zone. tone_zone must exist. if the indication already
* exists, it will be replaced. */
int ast_register_indication(struct ind_tone_zone *zone, const char *indication, const char *tonelist)
int ast_register_indication(struct tone_zone *zone, const char *indication, const char *tonelist)
{
struct ind_tone_zone_sound *ts,*ps;
struct tone_zone_sound *ts,*ps;
/* is it an alias? stop */
if (zone->alias[0])
@@ -560,9 +560,9 @@ int ast_register_indication(struct ind_tone_zone *zone, const char *indication,
}
/* remove an existing country's indication. Both country and indication must exist */
int ast_unregister_indication(struct ind_tone_zone *zone, const char *indication)
int ast_unregister_indication(struct tone_zone *zone, const char *indication)
{
struct ind_tone_zone_sound *ts,*ps = NULL, *tmp;
struct tone_zone_sound *ts,*ps = NULL, *tmp;
int res = -1;
/* is it an alias? stop */