Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
b68dae18
Commit
b68dae18
authored
7 years ago
by
Jenkins2
Committed by
Gerrit Code Review
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge "main/sounds: Use ast_cli_completion_add."
parents
dc2ce3ce
645203a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main/sounds.c
+19
-13
19 additions, 13 deletions
main/sounds.c
with
19 additions
and
13 deletions
main/sounds.c
+
19
−
13
View file @
b68dae18
...
...
@@ -219,6 +219,11 @@ static char *handle_cli_sounds_show(struct ast_cli_entry *e, int cmd, struct ast
/*! \brief Show details about a sound available in the system */
static
char
*
handle_cli_sound_show
(
struct
ast_cli_entry
*
e
,
int
cmd
,
struct
ast_cli_args
*
a
)
{
int
length
;
struct
ao2_iterator
it_sounds
;
char
*
filename
;
struct
ao2_container
*
sound_files
;
switch
(
cmd
)
{
case
CLI_INIT
:
e
->
command
=
"core show sound"
;
...
...
@@ -227,29 +232,30 @@ static char *handle_cli_sound_show(struct ast_cli_entry *e, int cmd, struct ast_
" Shows information about the specified sound.
\n
"
;
return
NULL
;
case
CLI_GENERATE
:
{
int
length
=
strlen
(
a
->
word
);
int
which
=
0
;
struct
ao2_iterator
it_sounds
;
char
*
match
=
NULL
;
char
*
filename
;
RAII_VAR
(
struct
ao2_container
*
,
sound_files
,
ast_media_get_media
(
sounds_index
),
ao2_cleanup
);
if
(
a
->
pos
!=
3
)
{
return
NULL
;
}
sound_files
=
ast_media_get_media
(
sounds_index
);
if
(
!
sound_files
)
{
return
NULL
;
}
length
=
strlen
(
a
->
word
);
it_sounds
=
ao2_iterator_init
(
sound_files
,
0
);
while
((
filename
=
ao2_iterator_next
(
&
it_sounds
)))
{
if
(
!
strncasecmp
(
a
->
word
,
filename
,
length
)
&&
++
which
>
a
->
n
)
{
match
=
ast_strdup
(
filename
);
ao2_ref
(
filename
,
-
1
);
break
;
if
(
!
strncasecmp
(
a
->
word
,
filename
,
length
))
{
if
(
ast_cli_completion_add
(
ast_strdup
(
filename
)))
{
ao2_ref
(
filename
,
-
1
);
break
;
}
}
ao2_ref
(
filename
,
-
1
);
}
ao2_iterator_destroy
(
&
it_sounds
);
return
match
;
}
ao2_ref
(
sound_files
,
-
1
);
return
NULL
;
}
if
(
a
->
argc
==
4
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment