diff --git a/meson.build b/meson.build index a9d50c9da..9f2edf35b 100644 --- a/meson.build +++ b/meson.build @@ -265,7 +265,6 @@ sources = [ version_cxx, 'src/Main.cxx', 'src/protocol/ArgParser.cxx', - 'src/protocol/Result.cxx', 'src/command/CommandError.cxx', 'src/command/PositionArg.cxx', 'src/command/AllCommands.cxx', diff --git a/src/client/Client.hxx b/src/client/Client.hxx index 5f9c6d10e..9ca7c6d3b 100644 --- a/src/client/Client.hxx +++ b/src/client/Client.hxx @@ -154,6 +154,10 @@ public: return Write(s.data(), s.size()); } + bool WriteOK() noexcept { + return Write("OK\n"); + } + /** * returns the uid of the client process, or a negative value * if the uid is unknown diff --git a/src/client/Process.cxx b/src/client/Process.cxx index 65c295032..041e339c7 100644 --- a/src/client/Process.cxx +++ b/src/client/Process.cxx @@ -20,7 +20,6 @@ #include "Client.hxx" #include "Config.hxx" #include "Domain.hxx" -#include "protocol/Result.hxx" #include "command/AllCommands.hxx" #include "Log.hxx" #include "util/StringAPI.hxx" @@ -72,7 +71,7 @@ Client::ProcessLine(char *line) noexcept if (idle_waiting) { /* send empty idle response and leave idle mode */ idle_waiting = false; - command_success(*this); + WriteOK(); } /* do nothing if the client wasn't idling: the client @@ -108,7 +107,7 @@ Client::ProcessLine(char *line) noexcept "list returned {}", id, unsigned(ret)); if (ret == CommandResult::OK) - command_success(*this); + WriteOK(); return ret; } else { @@ -144,7 +143,7 @@ Client::ProcessLine(char *line) noexcept return CommandResult::CLOSE; if (ret == CommandResult::OK) - command_success(*this); + WriteOK(); return ret; } diff --git a/src/client/ThreadBackgroundCommand.cxx b/src/client/ThreadBackgroundCommand.cxx index 4b8b05bb0..7026f709e 100644 --- a/src/client/ThreadBackgroundCommand.cxx +++ b/src/client/ThreadBackgroundCommand.cxx @@ -21,7 +21,6 @@ #include "Client.hxx" #include "Response.hxx" #include "command/CommandError.hxx" -#include "protocol/Result.hxx" ThreadBackgroundCommand::ThreadBackgroundCommand(Client &_client) noexcept :thread(BIND_THIS_METHOD(_Run)), @@ -57,7 +56,7 @@ ThreadBackgroundCommand::DeferredFinish() noexcept PrintError(response, error); } else { SendResponse(response); - command_success(client); + client.WriteOK(); } /* delete this object */ diff --git a/src/protocol/Result.cxx b/src/protocol/Result.cxx deleted file mode 100644 index e43073c1d..000000000 --- a/src/protocol/Result.cxx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "Result.hxx" -#include "client/Client.hxx" - -void -command_success(Client &client) -{ - client.Write("OK\n"); -} diff --git a/src/protocol/Result.hxx b/src/protocol/Result.hxx deleted file mode 100644 index 9dd6d5290..000000000 --- a/src/protocol/Result.hxx +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_PROTOCOL_RESULT_HXX -#define MPD_PROTOCOL_RESULT_HXX - -class Client; - -void -command_success(Client &client); - -#endif