aboutsummaryrefslogtreecommitdiffstats
path: root/src/MessageCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-20 13:10:54 +0200
committerMax Kellermann <max@duempel.org>2013-10-20 13:10:54 +0200
commitcf4d80fc655a399615529bdd27e0be284754c5ab (patch)
tree531f5c7af53ce4abdfd9013cbbc9e8056c934e5a /src/MessageCommands.cxx
parent8118bc93a85a903ddf95825c1ce7ecbbfff4780b (diff)
downloadmpd-cf4d80fc655a399615529bdd27e0be284754c5ab.tar.gz
mpd-cf4d80fc655a399615529bdd27e0be284754c5ab.tar.xz
mpd-cf4d80fc655a399615529bdd27e0be284754c5ab.zip
command: convert command_return to to a strictly-typed enum
Diffstat (limited to '')
-rw-r--r--src/MessageCommands.cxx32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/MessageCommands.cxx b/src/MessageCommands.cxx
index 9dd22418b..7d9893e70 100644
--- a/src/MessageCommands.cxx
+++ b/src/MessageCommands.cxx
@@ -31,29 +31,29 @@
#include <assert.h>
-enum command_return
+CommandResult
handle_subscribe(Client &client, gcc_unused int argc, char *argv[])
{
assert(argc == 2);
switch (client.Subscribe(argv[1])) {
case Client::SubscribeResult::OK:
- return COMMAND_RETURN_OK;
+ return CommandResult::OK;
case Client::SubscribeResult::INVALID:
command_error(client, ACK_ERROR_ARG,
"invalid channel name");
- return COMMAND_RETURN_ERROR;
+ return CommandResult::ERROR;
case Client::SubscribeResult::ALREADY:
command_error(client, ACK_ERROR_EXIST,
"already subscribed to this channel");
- return COMMAND_RETURN_ERROR;
+ return CommandResult::ERROR;
case Client::SubscribeResult::FULL:
command_error(client, ACK_ERROR_EXIST,
"subscription list is full");
- return COMMAND_RETURN_ERROR;
+ return CommandResult::ERROR;
}
/* unreachable */
@@ -61,21 +61,21 @@ handle_subscribe(Client &client, gcc_unused int argc, char *argv[])
gcc_unreachable();
}
-enum command_return
+CommandResult
handle_unsubscribe(Client &client, gcc_unused int argc, char *argv[])
{
assert(argc == 2);
if (client.Unsubscribe(argv[1]))
- return COMMAND_RETURN_OK;
+ return CommandResult::OK;
else {
command_error(client, ACK_ERROR_NO_EXIST,
"not subscribed to this channel");
- return COMMAND_RETURN_ERROR;
+ return CommandResult::ERROR;
}
}
-enum command_return
+CommandResult
handle_channels(Client &client,
gcc_unused int argc, gcc_unused char *argv[])
{
@@ -89,10 +89,10 @@ handle_channels(Client &client,
for (const auto &channel : channels)
client_printf(client, "channel: %s\n", channel.c_str());
- return COMMAND_RETURN_OK;
+ return CommandResult::OK;
}
-enum command_return
+CommandResult
handle_read_messages(Client &client,
gcc_unused int argc, gcc_unused char *argv[])
{
@@ -106,10 +106,10 @@ handle_read_messages(Client &client,
client.messages.pop_front();
}
- return COMMAND_RETURN_OK;
+ return CommandResult::OK;
}
-enum command_return
+CommandResult
handle_send_message(Client &client,
gcc_unused int argc, gcc_unused char *argv[])
{
@@ -118,7 +118,7 @@ handle_send_message(Client &client,
if (!client_message_valid_channel_name(argv[1])) {
command_error(client, ACK_ERROR_ARG,
"invalid channel name");
- return COMMAND_RETURN_ERROR;
+ return CommandResult::ERROR;
}
bool sent = false;
@@ -128,10 +128,10 @@ handle_send_message(Client &client,
sent = true;
if (sent)
- return COMMAND_RETURN_OK;
+ return CommandResult::OK;
else {
command_error(client, ACK_ERROR_NO_EXIST,
"nobody is subscribed to this channel");
- return COMMAND_RETURN_ERROR;
+ return CommandResult::ERROR;
}
}