aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorEric Wollesen <ericw@xmtp.net>2009-03-03 07:49:23 +0100
committerMax Kellermann <max@duempel.org>2009-03-03 07:49:23 +0100
commitb8ebb748c9e4da74c361c3b4e5840891eaf22864 (patch)
tree69368bd8f3e382be05644601f44b117c40ffdd45 /src/command.c
parent95b53281a45841bc4d981f131ac452615e923575 (diff)
downloadmpd-b8ebb748c9e4da74c361c3b4e5840891eaf22864.tar.gz
mpd-b8ebb748c9e4da74c361c3b4e5840891eaf22864.tar.xz
mpd-b8ebb748c9e4da74c361c3b4e5840891eaf22864.zip
Add sticker list command.
[mk: merged memory leak patch; fixed indentation (tabs); fixed documentation typo]
Diffstat (limited to '')
-rw-r--r--src/command.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/command.c b/src/command.c
index 6f97e06ef..5342662ca 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1473,13 +1473,41 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
g_free(value);
return COMMAND_RETURN_OK;
+ } else if (argc == 4 && strcmp(argv[1], "list") == 0) {
+ GList *list;
+ GPtrArray *values;
+ unsigned int x;
+
+ list = sticker_song_list_values(song);
+ if (NULL == list) {
+ command_error(client, ACK_ERROR_NO_EXIST,
+ "no stickers found");
+ return COMMAND_RETURN_ERROR;
+ }
+
+ for (x = 0; x < g_list_length(list); x++) {
+ values = g_list_nth_data(list, x);
+ if (NULL == values) {
+ g_warning("NULL sticker found");
+ continue;
+ }
+ client_printf(client, "sticker: %s=%s\n",
+ (char *)g_ptr_array_index(values, 0),
+ (char *)g_ptr_array_index(values, 1));
+ g_free(g_ptr_array_index(values, 0));
+ g_free(g_ptr_array_index(values, 1));
+ g_ptr_array_free(values, TRUE);
+ }
+ g_list_free(list);
+
+ return COMMAND_RETURN_OK;
} else if (argc == 6 && strcmp(argv[1], "set") == 0) {
bool ret;
ret = sticker_song_set_value(song, argv[4], argv[5]);
if (!ret) {
command_error(client, ACK_ERROR_SYSTEM,
- "failed to set sticker vqalue");
+ "failed to set sticker value");
return COMMAND_RETURN_ERROR;
}