aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-02-13 19:59:41 +0100
committerMax Kellermann <max@duempel.org>2012-02-13 20:30:27 +0100
commit5540fbaec250bbb8601d9eaec7f7c20922a67979 (patch)
tree89596b57d1d4ac0fc4db33e5a8b0fe4efca5e5a2 /src/command.c
parent0a0b473765fe5ba43f442e3d12853add3ff51415 (diff)
downloadmpd-5540fbaec250bbb8601d9eaec7f7c20922a67979.tar.gz
mpd-5540fbaec250bbb8601d9eaec7f7c20922a67979.tar.xz
mpd-5540fbaec250bbb8601d9eaec7f7c20922a67979.zip
command: new command "config"
Diffstat (limited to '')
-rw-r--r--src/command.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c
index 4479b803e..61f0fdd0c 100644
--- a/src/command.c
+++ b/src/command.c
@@ -55,6 +55,7 @@
#include "path.h"
#include "replay_gain_config.h"
#include "idle.h"
+#include "mapper.h"
#ifdef ENABLE_SQLITE
#include "sticker.h"
@@ -1697,6 +1698,23 @@ handle_not_commands(struct client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]);
static enum command_return
+handle_config(struct client *client,
+ G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
+{
+ if (!client_is_local(client)) {
+ command_error(client, ACK_ERROR_PERMISSION,
+ "Command only permitted to local clients");
+ return COMMAND_RETURN_ERROR;
+ }
+
+ const char *path = mapper_get_music_directory();
+ if (path != NULL)
+ client_printf(client, "music_directory: %s\n", path);
+
+ return COMMAND_RETURN_OK;
+}
+
+static enum command_return
handle_playlistclear(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
{
GError *error = NULL;
@@ -2139,6 +2157,7 @@ static const struct command commands[] = {
{ "clearerror", PERMISSION_CONTROL, 0, 0, handle_clearerror },
{ "close", PERMISSION_NONE, -1, -1, handle_close },
{ "commands", PERMISSION_NONE, 0, 0, handle_commands },
+ { "config", PERMISSION_ADMIN, 0, 0, handle_config },
{ "consume", PERMISSION_CONTROL, 1, 1, handle_consume },
{ "count", PERMISSION_READ, 2, -1, handle_count },
{ "crossfade", PERMISSION_CONTROL, 1, 1, handle_crossfade },