aboutsummaryrefslogtreecommitdiffstats
path: root/src/MessageCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-19 19:44:45 +0200
committerMax Kellermann <max@duempel.org>2013-10-19 19:44:45 +0200
commit75ba961e97606030d1c976696fb8623fbb0e27df (patch)
treec46a6e844a94c931445f4c225bb0b9ccd27cb623 /src/MessageCommands.cxx
parentc2d5ce0ca213e2d25df17e080b07a3d91d330972 (diff)
downloadmpd-75ba961e97606030d1c976696fb8623fbb0e27df.tar.gz
mpd-75ba961e97606030d1c976696fb8623fbb0e27df.tar.xz
mpd-75ba961e97606030d1c976696fb8623fbb0e27df.zip
Client: move message functions into the class
Diffstat (limited to '')
-rw-r--r--src/MessageCommands.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/MessageCommands.cxx b/src/MessageCommands.cxx
index c2b272713..9dd22418b 100644
--- a/src/MessageCommands.cxx
+++ b/src/MessageCommands.cxx
@@ -19,7 +19,6 @@
#include "config.h"
#include "MessageCommands.hxx"
-#include "ClientSubscribe.hxx"
#include "Client.hxx"
#include "ClientList.hxx"
#include "Instance.hxx"
@@ -37,28 +36,29 @@ handle_subscribe(Client &client, gcc_unused int argc, char *argv[])
{
assert(argc == 2);
- switch (client_subscribe(client, argv[1])) {
- case CLIENT_SUBSCRIBE_OK:
+ switch (client.Subscribe(argv[1])) {
+ case Client::SubscribeResult::OK:
return COMMAND_RETURN_OK;
- case CLIENT_SUBSCRIBE_INVALID:
+ case Client::SubscribeResult::INVALID:
command_error(client, ACK_ERROR_ARG,
"invalid channel name");
return COMMAND_RETURN_ERROR;
- case CLIENT_SUBSCRIBE_ALREADY:
+ case Client::SubscribeResult::ALREADY:
command_error(client, ACK_ERROR_EXIST,
"already subscribed to this channel");
return COMMAND_RETURN_ERROR;
- case CLIENT_SUBSCRIBE_FULL:
+ case Client::SubscribeResult::FULL:
command_error(client, ACK_ERROR_EXIST,
"subscription list is full");
return COMMAND_RETURN_ERROR;
}
/* unreachable */
- return COMMAND_RETURN_OK;
+ assert(false);
+ gcc_unreachable();
}
enum command_return
@@ -66,7 +66,7 @@ handle_unsubscribe(Client &client, gcc_unused int argc, char *argv[])
{
assert(argc == 2);
- if (client_unsubscribe(client, argv[1]))
+ if (client.Unsubscribe(argv[1]))
return COMMAND_RETURN_OK;
else {
command_error(client, ACK_ERROR_NO_EXIST,
@@ -124,7 +124,7 @@ handle_send_message(Client &client,
bool sent = false;
const ClientMessage msg(argv[1], argv[2]);
for (const auto &c : *instance->client_list)
- if (client_push_message(*c, msg))
+ if (c->PushMessage(msg))
sent = true;
if (sent)