diff options
author | Max Kellermann <max@duempel.org> | 2015-08-06 22:10:25 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-08-12 08:41:05 +0200 |
commit | 7652a2986b0d0ad55b2776685130f1c68d7108c7 (patch) | |
tree | b4d45e60e97757454f1ff8e4dc793a1e7d852c36 /src/command/TagCommands.cxx | |
parent | b1480167be487d09ff46bb86ad02041fb28acff1 (diff) | |
download | mpd-7652a2986b0d0ad55b2776685130f1c68d7108c7.tar.gz mpd-7652a2986b0d0ad55b2776685130f1c68d7108c7.tar.xz mpd-7652a2986b0d0ad55b2776685130f1c68d7108c7.zip |
client/Response: new Client wrapper class for writing responses
Diffstat (limited to 'src/command/TagCommands.cxx')
-rw-r--r-- | src/command/TagCommands.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/command/TagCommands.cxx b/src/command/TagCommands.cxx index 2690f39bf..35efa5859 100644 --- a/src/command/TagCommands.cxx +++ b/src/command/TagCommands.cxx @@ -22,7 +22,7 @@ #include "Request.hxx" #include "CommandError.hxx" #include "client/Client.hxx" -#include "protocol/Result.hxx" +#include "client/Response.hxx" #include "tag/Tag.hxx" #include "Partition.hxx" #include "util/ConstBuffer.hxx" @@ -30,15 +30,16 @@ CommandResult handle_addtagid(Client &client, Request args) { + Response r(client); + unsigned song_id; - if (!args.Parse(0, song_id, client)) + if (!args.Parse(0, song_id, r)) return CommandResult::ERROR; const char *const tag_name = args[1]; const TagType tag_type = tag_name_parse_i(tag_name); if (tag_type == TAG_NUM_OF_ITEM_TYPES) { - command_error(client, ACK_ERROR_ARG, - "Unknown tag type: %s", tag_name); + r.FormatError(ACK_ERROR_ARG, "Unknown tag type: %s", tag_name); return CommandResult::ERROR; } @@ -47,7 +48,7 @@ handle_addtagid(Client &client, Request args) Error error; if (!client.partition.playlist.AddSongIdTag(song_id, tag_type, value, error)) - return print_error(client, error); + return print_error(r, error); return CommandResult::OK; } @@ -55,8 +56,10 @@ handle_addtagid(Client &client, Request args) CommandResult handle_cleartagid(Client &client, Request args) { + Response r(client); + unsigned song_id; - if (!args.Parse(0, song_id, client)) + if (!args.Parse(0, song_id, r)) return CommandResult::ERROR; TagType tag_type = TAG_NUM_OF_ITEM_TYPES; @@ -64,7 +67,7 @@ handle_cleartagid(Client &client, Request args) const char *const tag_name = args[1]; tag_type = tag_name_parse_i(tag_name); if (tag_type == TAG_NUM_OF_ITEM_TYPES) { - command_error(client, ACK_ERROR_ARG, + r.FormatError(ACK_ERROR_ARG, "Unknown tag type: %s", tag_name); return CommandResult::ERROR; } @@ -73,7 +76,7 @@ handle_cleartagid(Client &client, Request args) Error error; if (!client.partition.playlist.ClearSongIdTag(song_id, tag_type, error)) - return print_error(client, error); + return print_error(r, error); return CommandResult::OK; } |