aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-02 22:13:58 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-02 22:13:58 +0000
commit44eb26c16fb66908f75d395e63a16c343c28e00d (patch)
tree34a098ea018bfea9305300662d1b0dfe10a2deb5 /src/command.c
parent69176148bfd4a9a40a8d653997a6f2714d65776b (diff)
downloadmpd-44eb26c16fb66908f75d395e63a16c343c28e00d.tar.gz
mpd-44eb26c16fb66908f75d395e63a16c343c28e00d.tar.xz
mpd-44eb26c16fb66908f75d395e63a16c343c28e00d.zip
new commands: enalbe_device, and disable_device, (maybe these commands should be toggles instead of two seperate commands?)
also, on close device, close the shout connection git-svn-id: https://svn.musicpd.org/mpd/trunk@2485 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/command.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c
index 2155485a1..a98c1cf1f 100644
--- a/src/command.c
+++ b/src/command.c
@@ -82,6 +82,8 @@
#define COMMAND_URL_HANDLERS "urlhandlers"
#define COMMAND_PLCHANGES "plchanges"
#define COMMAND_CURRENTSONG "currentsong"
+#define COMMAND_ENABLE_DEV "enable_device"
+#define COMMAND_DISABLE_DEV "disable_device"
#define COMMAND_STATUS_VOLUME "volume"
#define COMMAND_STATUS_STATE "state"
@@ -756,6 +758,38 @@ int handleCrossfade(FILE * fp, unsigned int * permission, int argArrayLength,
return 0;
}
+int handleEnableDevice(FILE * fp, unsigned int * permission, int argArrayLength,
+ char ** argArray)
+{
+ int device;
+ char * test;
+
+ device = strtol(argArray[1],&test,10);
+ if(*test!='\0' || device<0) {
+ commandError(fp, ACK_ERROR_ARG,
+ "\"%s\" is not a integer >= 0", argArray[1]);
+ return -1;
+ }
+
+ return enableAudioDevice(fp, device);
+}
+
+int handleDisableDevice(FILE * fp, unsigned int * permission,
+ int argArrayLength, char ** argArray)
+{
+ int device;
+ char * test;
+
+ device = strtol(argArray[1],&test,10);
+ if(*test!='\0' || device<0) {
+ commandError(fp, ACK_ERROR_ARG,
+ "\"%s\" is not a integer >= 0", argArray[1]);
+ return -1;
+ }
+
+ return disableAudioDevice(fp, device);
+}
+
void initCommands() {
commandList = makeList(free);
@@ -804,6 +838,8 @@ void initCommands() {
addCommand(COMMAND_CROSSFADE ,PERMISSION_CONTROL, 1, 1,handleCrossfade,NULL);
addCommand(COMMAND_URL_HANDLERS,PERMISSION_READ, 0, 0,handleUrlHandlers,NULL);
addCommand(COMMAND_PLCHANGES ,PERMISSION_READ, 1, 1,handlePlaylistChanges,NULL);
+ addCommand(COMMAND_ENABLE_DEV ,PERMISSION_ADMIN, 1, 1,handleEnableDevice,NULL);
+ addCommand(COMMAND_DISABLE_DEV ,PERMISSION_ADMIN, 1, 1,handleDisableDevice,NULL);
sortList(commandList);
}