aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/PlaylistCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-08-13 12:48:31 +0200
committerMax Kellermann <max@duempel.org>2015-08-13 12:48:31 +0200
commit86e036c3933def22b6ff0eae5bcf9cd7103240e7 (patch)
treee8d812461e22b189cea3b3df908515cebbfe0cd1 /src/command/PlaylistCommands.cxx
parent7652a2986b0d0ad55b2776685130f1c68d7108c7 (diff)
downloadmpd-86e036c3933def22b6ff0eae5bcf9cd7103240e7.tar.gz
mpd-86e036c3933def22b6ff0eae5bcf9cd7103240e7.tar.xz
mpd-86e036c3933def22b6ff0eae5bcf9cd7103240e7.zip
command: pass Response object to command callbacks
Diffstat (limited to '')
-rw-r--r--src/command/PlaylistCommands.cxx44
1 files changed, 12 insertions, 32 deletions
diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx
index 1e075e088..625e82055 100644
--- a/src/command/PlaylistCommands.cxx
+++ b/src/command/PlaylistCommands.cxx
@@ -59,9 +59,8 @@ print_spl_list(Response &r, const PlaylistVector &list)
}
CommandResult
-handle_save(Client &client, Request args)
+handle_save(Client &client, Request args, Response &r)
{
- Response r(client);
Error error;
return spl_save_playlist(args.front(), client.playlist, error)
? CommandResult::OK
@@ -69,10 +68,8 @@ handle_save(Client &client, Request args)
}
CommandResult
-handle_load(Client &client, Request args)
+handle_load(Client &client, Request args, Response &r)
{
- Response r(client);
-
RangeArg range = RangeArg::All();
if (!args.ParseOptional(1, range, r))
return CommandResult::ERROR;
@@ -91,10 +88,8 @@ handle_load(Client &client, Request args)
}
CommandResult
-handle_listplaylist(Client &client, Request args)
+handle_listplaylist(Client &client, Request args, Response &r)
{
- Response r(client);
-
const char *const name = args.front();
if (playlist_file_print(r, client.partition, SongLoader(client),
@@ -108,10 +103,8 @@ handle_listplaylist(Client &client, Request args)
}
CommandResult
-handle_listplaylistinfo(Client &client, Request args)
+handle_listplaylistinfo(Client &client, Request args, Response &r)
{
- Response r(client);
-
const char *const name = args.front();
if (playlist_file_print(r, client.partition, SongLoader(client),
@@ -125,10 +118,8 @@ handle_listplaylistinfo(Client &client, Request args)
}
CommandResult
-handle_rm(Client &client, Request args)
+handle_rm(gcc_unused Client &client, Request args, Response &r)
{
- Response r(client);
-
const char *const name = args.front();
Error error;
@@ -138,10 +129,8 @@ handle_rm(Client &client, Request args)
}
CommandResult
-handle_rename(Client &client, Request args)
+handle_rename(gcc_unused Client &client, Request args, Response &r)
{
- Response r(client);
-
const char *const old_name = args[0];
const char *const new_name = args[1];
@@ -152,10 +141,8 @@ handle_rename(Client &client, Request args)
}
CommandResult
-handle_playlistdelete(Client &client, Request args)
+handle_playlistdelete(gcc_unused Client &client, Request args, Response &r)
{
- Response r(client);
-
const char *const name = args[0];
unsigned from;
if (!args.Parse(1, from, r))
@@ -168,10 +155,8 @@ handle_playlistdelete(Client &client, Request args)
}
CommandResult
-handle_playlistmove(Client &client, Request args)
+handle_playlistmove(gcc_unused Client &client, Request args, Response &r)
{
- Response r(client);
-
const char *const name = args.front();
unsigned from, to;
if (!args.Parse(1, from, r) || !args.Parse(2, to, r))
@@ -184,10 +169,8 @@ handle_playlistmove(Client &client, Request args)
}
CommandResult
-handle_playlistclear(Client &client, Request args)
+handle_playlistclear(gcc_unused Client &client, Request args, Response &r)
{
- Response r(client);
-
const char *const name = args.front();
Error error;
@@ -197,10 +180,8 @@ handle_playlistclear(Client &client, Request args)
}
CommandResult
-handle_playlistadd(Client &client, Request args)
+handle_playlistadd(Client &client, Request args, Response &r)
{
- Response r(client);
-
const char *const playlist = args[0];
const char *const uri = args[1];
@@ -232,10 +213,9 @@ handle_playlistadd(Client &client, Request args)
}
CommandResult
-handle_listplaylists(Client &client, gcc_unused Request args)
+handle_listplaylists(gcc_unused Client &client, gcc_unused Request args,
+ Response &r)
{
- Response r(client);
-
Error error;
const auto list = ListPlaylistFiles(error);
if (list.empty() && error.IsDefined())