aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-08 18:01:36 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-08 18:01:36 +0000
commitb3f3f35f9901fae2c340813b69d23e96f85dde3e (patch)
treec36b900607959dfb00495fa42581ec527d17abc5
parent3c3cfc3574f2a6fb898c71e6d4b890fa038b81e5 (diff)
downloadmpd-b3f3f35f9901fae2c340813b69d23e96f85dde3e.tar.gz
mpd-b3f3f35f9901fae2c340813b69d23e96f85dde3e.tar.xz
mpd-b3f3f35f9901fae2c340813b69d23e96f85dde3e.zip
new command "commands" for avuton
git-svn-id: https://svn.musicpd.org/mpd/trunk@2547 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--TODO2
-rw-r--r--src/command.c22
2 files changed, 22 insertions, 2 deletions
diff --git a/TODO b/TODO
index 5cfc5726c..4bebf4f18 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,5 @@
0.12
----
-*) permissions command to print out permissions info
-
*) rewrite saved playlist code
*) abstract out saved playlists from playlist.c
*) command for displaying playlist contents
diff --git a/src/command.c b/src/command.c
index 6ccb51579..6341972cf 100644
--- a/src/command.c
+++ b/src/command.c
@@ -86,6 +86,7 @@
#define COMMAND_ENABLE_DEV "enabledevice"
#define COMMAND_DISABLE_DEV "disabledevice"
#define COMMAND_DEVICES "devices"
+#define COMMAND_COMMANDS "commands"
#define COMMAND_STATUS_VOLUME "volume"
#define COMMAND_STATUS_STATE "state"
@@ -806,6 +807,26 @@ int handleDevices(FILE * fp, unsigned int * permission, int argArrayLength,
return 0;
}
+/* don't be fooled, this is the command handler for "commands" command */
+int handleCommands(FILE * fp, unsigned int * permission, int argArrayLength,
+ char ** argArray)
+{
+ ListNode * node = commandList->firstNode;
+ CommandEntry * cmd;
+
+ while(node != NULL) {
+ cmd = (CommandEntry *) node->data;
+
+ if(*permission & cmd->reqPermission) {
+ myfprintf(fp, "command: %s\n", cmd->cmd);
+ }
+
+ node = node->nextNode;
+ }
+
+ return 0;
+}
+
void initCommands() {
commandList = makeList(free);
@@ -858,6 +879,7 @@ void initCommands() {
addCommand(COMMAND_ENABLE_DEV ,PERMISSION_ADMIN, 1, 1,handleEnableDevice,NULL);
addCommand(COMMAND_DISABLE_DEV ,PERMISSION_ADMIN, 1, 1,handleDisableDevice,NULL);
addCommand(COMMAND_DEVICES ,PERMISSION_ADMIN, 0, 0,handleDevices,NULL);
+ addCommand(COMMAND_COMMANDS ,0, 0, 0,handleCommands,NULL);
sortList(commandList);
}