Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Icecast-Server
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Rohit Verma
Icecast-Server
Commits
7e7624b3
Commit
7e7624b3
authored
4 years ago
by
Philipp Schafft
Browse files
Options
Downloads
Patches
Plain Diff
Feature: Added support to give navigation direction via admin call for command_move_clients()
parent
99e7227f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
admin/moveclients.xsl
+10
-3
10 additions, 3 deletions
admin/moveclients.xsl
src/admin.c
+4
-1
4 additions, 1 deletion
src/admin.c
src/navigation.c
+18
-0
18 additions, 0 deletions
src/navigation.c
src/navigation.h
+1
-0
1 addition, 0 deletions
src/navigation.h
with
33 additions
and
4 deletions
admin/moveclients.xsl
+
10
−
3
View file @
7e7624b3
...
...
@@ -26,9 +26,9 @@
</xsl:otherwise>
</xsl:choose>
<form
method=
"post"
action=
"/admin/moveclients.xsl"
>
<label
for=
"moveto"
class=
"hidden"
>
Move from
<code><xsl:value-of
select=
"current_source"
/></code>
to
</label>
Move from
<code><xsl:value-of
select=
"current_source"
/></code>
to
<select
name=
"destination"
id=
"moveto"
>
<xsl:for-each
select=
"source"
>
<option
value=
"{@mount}"
>
...
...
@@ -36,6 +36,13 @@
</option>
</xsl:for-each>
</select>
with direction
<select
name=
"direction"
>
<option
value=
"up"
>
up
</option>
<option
value=
"down"
>
down
</option>
<option
value=
"replace-current"
>
replace
</option>
<option
value=
"replace-all"
>
forget and replace
</option>
</select>
<input
type=
"hidden"
name=
"mount"
value=
"{current_source}"
/>
 
<input
type=
"submit"
value=
"Move listeners"
/>
...
...
This diff is collapsed.
Click to expand it.
src/admin.c
+
4
−
1
View file @
7e7624b3
...
...
@@ -716,6 +716,7 @@ static void command_move_clients(client_t *client,
{
const
char
*
dest_source
;
const
char
*
idtext
=
NULL
;
const
char
*
directiontext
=
NULL
;
connection_id_t
id
;
source_t
*
dest
;
char
buf
[
255
];
...
...
@@ -730,6 +731,8 @@ static void command_move_clients(client_t *client,
}
else
{
idtext
=
NULL
;
}
COMMAND_OPTIONAL
(
client
,
"direction"
,
directiontext
);
ICECAST_LOG_DEBUG
(
"Done optional check (%d)"
,
parameters_passed
);
if
(
!
parameters_passed
)
{
xmlDocPtr
doc
=
admin_build_sourcelist
(
source
->
mount
,
client
,
response
);
...
...
@@ -766,7 +769,7 @@ static void command_move_clients(client_t *client,
ICECAST_LOG_INFO
(
"source is
\"
%s
\"
, destination is
\"
%s
\"
"
,
source
->
mount
,
dest
->
mount
);
source_move_clients
(
source
,
dest
,
idtext
?
&
id
:
NULL
);
source_move_clients
(
source
,
dest
,
idtext
?
&
id
:
NULL
,
navigation_str_to_direction
(
directiontext
,
NAVIGATION_DIRECTION_DOWN
)
);
snprintf
(
buf
,
sizeof
(
buf
),
"Clients moved from %s to %s"
,
source
->
mount
,
dest_source
);
...
...
This diff is collapsed.
Click to expand it.
src/navigation.c
+
18
−
0
View file @
7e7624b3
...
...
@@ -36,6 +36,24 @@ const char * navigation_direction_to_str(navigation_direction_t dir)
return
NULL
;
}
navigation_direction_t
navigation_str_to_direction
(
const
char
*
str
,
navigation_direction_t
def
)
{
if
(
!
str
||
!*
str
)
return
def
;
if
(
strcasecmp
(
str
,
"up"
)
==
0
)
{
return
NAVIGATION_DIRECTION_UP
;
}
else
if
(
strcasecmp
(
str
,
"down"
)
==
0
)
{
return
NAVIGATION_DIRECTION_DOWN
;
}
else
if
(
strcasecmp
(
str
,
"replace_current"
)
==
0
||
strcasecmp
(
str
,
"replace-current"
)
==
0
)
{
return
NAVIGATION_DIRECTION_REPLACE_CURRENT
;
}
else
if
(
strcasecmp
(
str
,
"replace_all"
)
==
0
||
strcasecmp
(
str
,
"replace-all"
)
==
0
)
{
return
NAVIGATION_DIRECTION_REPLACE_ALL
;
}
else
{
return
def
;
}
}
static
int
mount_identifier_compare__for_tree
(
void
*
compare_arg
,
void
*
a
,
void
*
b
)
{
const
char
*
id_a
,
*
id_b
;
...
...
This diff is collapsed.
Click to expand it.
src/navigation.h
+
1
−
0
View file @
7e7624b3
...
...
@@ -30,6 +30,7 @@ typedef enum {
REFOBJECT_FORWARD_TYPE
(
mount_identifier_t
);
const
char
*
navigation_direction_to_str
(
navigation_direction_t
dir
);
navigation_direction_t
navigation_str_to_direction
(
const
char
*
str
,
navigation_direction_t
def
);
void
navigation_initialize
(
void
);
void
navigation_shutdown
(
void
);
...
...
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