mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-19 03:07:59 +00:00
automerge commit
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@69307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -42,10 +42,10 @@ static char *group_count_function_read(struct ast_channel *chan, char *cmd, char
|
|||||||
|
|
||||||
ast_app_group_split_group(data, group, sizeof(group), category, sizeof(category));
|
ast_app_group_split_group(data, group, sizeof(group), category, sizeof(category));
|
||||||
|
|
||||||
if ((count = ast_app_group_get_count(group, category)) == -1)
|
if ((count = ast_app_group_get_count(group, category)) == -1)
|
||||||
ast_log(LOG_NOTICE, "No group could be found for channel '%s'\n", chan->name);
|
ast_log(LOG_NOTICE, "No group could be found for channel '%s'\n", chan->name);
|
||||||
else
|
else
|
||||||
snprintf(buf, len, "%d", count);
|
snprintf(buf, len, "%d", count);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@@ -93,25 +93,23 @@ struct ast_custom_function group_match_count_function = {
|
|||||||
|
|
||||||
static char *group_function_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
static char *group_function_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
||||||
{
|
{
|
||||||
struct ast_group_info *gi = NULL;
|
struct ast_group_info *gi = NULL;
|
||||||
|
|
||||||
ast_app_group_list_lock();
|
ast_app_group_list_lock();
|
||||||
|
|
||||||
gi = ast_app_group_list_head();
|
for (gi = ast_app_group_list_head(); gi; gi = AST_LIST_NEXT(gi, list)) {
|
||||||
while (gi) {
|
if (gi->chan != chan)
|
||||||
if (gi->chan != chan)
|
continue;
|
||||||
continue;
|
if (ast_strlen_zero(data))
|
||||||
if (ast_strlen_zero(data))
|
break;
|
||||||
break;
|
if (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, data))
|
||||||
if (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, data))
|
break;
|
||||||
break;
|
}
|
||||||
gi = AST_LIST_NEXT(gi, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gi)
|
if (gi)
|
||||||
ast_copy_string(buf, gi->group, len);
|
ast_copy_string(buf, gi->group, len);
|
||||||
|
|
||||||
ast_app_group_list_unlock();
|
ast_app_group_list_unlock();
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@@ -126,8 +124,8 @@ static void group_function_write(struct ast_channel *chan, char *cmd, char *data
|
|||||||
ast_copy_string(grpcat, value, sizeof(grpcat));
|
ast_copy_string(grpcat, value, sizeof(grpcat));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_app_group_set_channel(chan, grpcat))
|
if (ast_app_group_set_channel(chan, grpcat))
|
||||||
ast_log(LOG_WARNING, "Setting a group requires an argument (group name)\n");
|
ast_log(LOG_WARNING, "Setting a group requires an argument (group name)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BUILTIN_FUNC
|
#ifndef BUILTIN_FUNC
|
||||||
@@ -144,34 +142,32 @@ struct ast_custom_function group_function = {
|
|||||||
|
|
||||||
static char *group_list_function_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
static char *group_list_function_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
||||||
{
|
{
|
||||||
struct ast_group_info *gi = NULL;
|
struct ast_group_info *gi = NULL;
|
||||||
char tmp1[1024] = "";
|
char tmp1[1024] = "";
|
||||||
char tmp2[1024] = "";
|
char tmp2[1024] = "";
|
||||||
|
|
||||||
ast_app_group_list_lock();
|
ast_app_group_list_lock();
|
||||||
|
|
||||||
gi = ast_app_group_list_head();
|
for (gi = ast_app_group_list_head(); gi; gi = AST_LIST_NEXT(gi, list)) {
|
||||||
while (gi) {
|
if (gi->chan != chan)
|
||||||
if (gi->chan != chan)
|
continue;
|
||||||
continue;
|
if (!ast_strlen_zero(tmp1)) {
|
||||||
if (!ast_strlen_zero(tmp1)) {
|
ast_copy_string(tmp2, tmp1, sizeof(tmp2));
|
||||||
ast_copy_string(tmp2, tmp1, sizeof(tmp2));
|
if (!ast_strlen_zero(gi->category))
|
||||||
if (!ast_strlen_zero(gi->category))
|
snprintf(tmp1, sizeof(tmp1), "%s %s@%s", tmp2, gi->group, gi->category);
|
||||||
snprintf(tmp1, sizeof(tmp1), "%s %s@%s", tmp2, gi->group, gi->category);
|
else
|
||||||
else
|
snprintf(tmp1, sizeof(tmp1), "%s %s", tmp2, gi->group);
|
||||||
snprintf(tmp1, sizeof(tmp1), "%s %s", tmp2, gi->group);
|
} else {
|
||||||
} else {
|
if (!ast_strlen_zero(gi->category))
|
||||||
if (!ast_strlen_zero(gi->category))
|
snprintf(tmp1, sizeof(tmp1), "%s@%s", gi->group, gi->category);
|
||||||
snprintf(tmp1, sizeof(tmp1), "%s@%s", gi->group, gi->category);
|
else
|
||||||
else
|
snprintf(tmp1, sizeof(tmp1), "%s", gi->group);
|
||||||
snprintf(tmp1, sizeof(tmp1), "%s", gi->group);
|
}
|
||||||
}
|
}
|
||||||
gi = AST_LIST_NEXT(gi, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
ast_app_group_list_unlock();
|
ast_app_group_list_unlock();
|
||||||
|
|
||||||
ast_copy_string(buf, tmp1, len);
|
ast_copy_string(buf, tmp1, len);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user