Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
7d87f71d
Commit
7d87f71d
authored
Jan 04, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command: check URI scheme in "addid"
Check if the URI scheme is supported by MPD, and print an error message if not. Optimize the checks in "add" and "playlistadd".
parent
ef0b328a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
12 deletions
+22
-12
command.c
src/command.c
+22
-12
No files found.
src/command.c
View file @
7d87f71d
...
@@ -461,13 +461,14 @@ handle_add(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -461,13 +461,14 @@ handle_add(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
if
(
isRemoteUrl
(
uri
))
return
addToPlaylist
(
uri
,
NULL
);
if
(
uri_has_scheme
(
uri
))
{
if
(
uri_has_scheme
(
uri
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
if
(
!
isRemoteUrl
(
uri
))
{
"unsupported URI scheme"
);
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
return
COMMAND_RETURN_ERROR
;
"unsupported URI scheme"
);
return
COMMAND_RETURN_ERROR
;
}
return
addToPlaylist
(
uri
,
NULL
);
}
}
result
=
addAllIn
(
uri
);
result
=
addAllIn
(
uri
);
...
@@ -495,8 +496,15 @@ handle_addid(struct client *client, int argc, char *argv[])
...
@@ -495,8 +496,15 @@ handle_addid(struct client *client, int argc, char *argv[])
client_get_uid
(
client
),
client_get_uid
(
client
),
&
added_id
);
&
added_id
);
#endif
#endif
}
else
}
else
{
if
(
uri_has_scheme
(
uri
)
&&
!
isRemoteUrl
(
uri
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"unsupported URI scheme"
);
return
COMMAND_RETURN_ERROR
;
}
result
=
addToPlaylist
(
uri
,
&
added_id
);
result
=
addToPlaylist
(
uri
,
&
added_id
);
}
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
...
@@ -1249,12 +1257,14 @@ handle_playlistadd(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -1249,12 +1257,14 @@ handle_playlistadd(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
char
*
uri
=
argv
[
2
];
char
*
uri
=
argv
[
2
];
enum
playlist_result
result
;
enum
playlist_result
result
;
if
(
isRemoteUrl
(
uri
))
if
(
uri_has_scheme
(
uri
))
{
if
(
!
isRemoteUrl
(
uri
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"unsupported URI scheme"
);
return
COMMAND_RETURN_ERROR
;
}
result
=
spl_append_uri
(
uri
,
playlist
);
result
=
spl_append_uri
(
uri
,
playlist
);
else
if
(
uri_has_scheme
(
uri
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"unsupported URI scheme"
);
return
COMMAND_RETURN_ERROR
;
}
else
}
else
result
=
addAllInToStoredPlaylist
(
uri
,
playlist
);
result
=
addAllInToStoredPlaylist
(
uri
,
playlist
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment