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/OutputCommands.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 '')
-rw-r--r-- | src/command/OutputCommands.cxx | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/command/OutputCommands.cxx b/src/command/OutputCommands.cxx index 39602aba8..472516860 100644 --- a/src/command/OutputCommands.cxx +++ b/src/command/OutputCommands.cxx @@ -22,23 +22,23 @@ #include "Request.hxx" #include "output/OutputPrint.hxx" #include "output/OutputCommand.hxx" -#include "protocol/Result.hxx" #include "client/Client.hxx" +#include "client/Response.hxx" #include "Partition.hxx" #include "util/ConstBuffer.hxx" CommandResult handle_enableoutput(Client &client, Request args) { - assert(args.size == 1); + Response r(client); + assert(args.size == 1); unsigned device; - if (!args.Parse(0, device, client)) + if (!args.Parse(0, device, r)) return CommandResult::ERROR; if (!audio_output_enable_index(client.partition.outputs, device)) { - command_error(client, ACK_ERROR_NO_EXIST, - "No such audio output"); + r.Error(ACK_ERROR_NO_EXIST, "No such audio output"); return CommandResult::ERROR; } @@ -48,15 +48,15 @@ handle_enableoutput(Client &client, Request args) CommandResult handle_disableoutput(Client &client, Request args) { - assert(args.size == 1); + Response r(client); + assert(args.size == 1); unsigned device; - if (!args.Parse(0, device, client)) + if (!args.Parse(0, device, r)) return CommandResult::ERROR; if (!audio_output_disable_index(client.partition.outputs, device)) { - command_error(client, ACK_ERROR_NO_EXIST, - "No such audio output"); + r.Error(ACK_ERROR_NO_EXIST, "No such audio output"); return CommandResult::ERROR; } @@ -66,15 +66,15 @@ handle_disableoutput(Client &client, Request args) CommandResult handle_toggleoutput(Client &client, Request args) { - assert(args.size == 1); + Response r(client); + assert(args.size == 1); unsigned device; - if (!args.Parse(0, device, client)) + if (!args.Parse(0, device, r)) return CommandResult::ERROR; if (!audio_output_toggle_index(client.partition.outputs, device)) { - command_error(client, ACK_ERROR_NO_EXIST, - "No such audio output"); + r.Error(ACK_ERROR_NO_EXIST, "No such audio output"); return CommandResult::ERROR; } @@ -86,7 +86,8 @@ handle_devices(Client &client, gcc_unused Request args) { assert(args.IsEmpty()); - printAudioDevices(client, client.partition.outputs); + Response r(client); + printAudioDevices(r, client.partition.outputs); return CommandResult::OK; } |