diff options
author | Max Kellermann <max@duempel.org> | 2015-08-14 19:02:08 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-08-14 19:04:00 +0200 |
commit | 8e408725e98f1f5dc0cc9299c70d22fcacfdb3a6 (patch) | |
tree | 02b507544fa7e2a2d4b3bcb327ba6d3eeeb4053e /src/command/AllCommands.cxx | |
parent | d053797340ae16b16186fe31d60bb12979ba9b81 (diff) | |
download | mpd-8e408725e98f1f5dc0cc9299c70d22fcacfdb3a6.tar.gz mpd-8e408725e98f1f5dc0cc9299c70d22fcacfdb3a6.tar.xz mpd-8e408725e98f1f5dc0cc9299c70d22fcacfdb3a6.zip |
protocol/Result: move current_command to class Response
Diffstat (limited to 'src/command/AllCommands.cxx')
-rw-r--r-- | src/command/AllCommands.cxx | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/command/AllCommands.cxx b/src/command/AllCommands.cxx index f98018f88..66d10ef1b 100644 --- a/src/command/AllCommands.cxx +++ b/src/command/AllCommands.cxx @@ -33,7 +33,6 @@ #include "OtherCommands.hxx" #include "Permission.hxx" #include "tag/TagType.h" -#include "protocol/Result.hxx" #include "Partition.hxx" #include "client/Client.hxx" #include "client/Response.hxx" @@ -343,8 +342,6 @@ static const struct command * command_checked_lookup(Response &r, unsigned permission, const char *cmd_name, Request args) { - current_command = ""; - const struct command *cmd = command_lookup(cmd_name); if (cmd == nullptr) { r.FormatError(ACK_ERROR_UNKNOWN, @@ -352,7 +349,7 @@ command_checked_lookup(Response &r, unsigned permission, return nullptr; } - current_command = cmd->cmd; + r.SetCommand(cmd->cmd); if (!command_check_request(cmd, r, permission, args)) return nullptr; @@ -372,18 +369,13 @@ command_process(Client &client, unsigned num, char *line) Tokenizer tokenizer(line); - const char *const cmd_name = current_command = - tokenizer.NextWord(error); + const char *const cmd_name = tokenizer.NextWord(error); if (cmd_name == nullptr) { - current_command = ""; - if (tokenizer.IsEnd()) r.FormatError(ACK_ERROR_UNKNOWN, "No command given"); else r.Error(ACK_ERROR_UNKNOWN, error.GetMessage()); - current_command = nullptr; - /* this client does not speak the MPD protocol; kick the connection */ return CommandResult::FINISH; @@ -397,7 +389,6 @@ command_process(Client &client, unsigned num, char *line) while (true) { if (args.size == COMMAND_ARGV_MAX) { r.Error(ACK_ERROR_ARG, "Too many arguments"); - current_command = nullptr; return CommandResult::ERROR; } @@ -407,7 +398,6 @@ command_process(Client &client, unsigned num, char *line) break; r.Error(ACK_ERROR_UNKNOWN, error.GetMessage()); - current_command = nullptr; return CommandResult::ERROR; } @@ -424,7 +414,5 @@ command_process(Client &client, unsigned num, char *line) ? cmd->handler(client, args, r) : CommandResult::ERROR; - current_command = nullptr; - return ret; } |