Commit 24da9410 authored by Max Kellermann's avatar Max Kellermann

command: use sticker_song_get() instead of sticker_song_list_values()

parent dd67992a
...@@ -1455,11 +1455,12 @@ handle_idle(struct client *client, ...@@ -1455,11 +1455,12 @@ handle_idle(struct client *client,
} }
#ifdef ENABLE_SQLITE #ifdef ENABLE_SQLITE
static void print_sticker(GString *name, GString *value, static void
struct client *client) print_sticker(const char *name, const char *value, gpointer data)
{ {
client_printf(client, "sticker: %s=%s\n", struct client *client = data;
(char *)name, (char *)value);
client_printf(client, "sticker: %s=%s\n", name, value);
} }
static enum command_return static enum command_return
...@@ -1488,17 +1489,15 @@ handle_sticker_song(struct client *client, int argc, char *argv[]) ...@@ -1488,17 +1489,15 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
} else if (argc == 4 && strcmp(argv[1], "list") == 0) { } else if (argc == 4 && strcmp(argv[1], "list") == 0) {
GHashTable *hash; struct sticker *sticker = sticker_song_get(song);
if (NULL == sticker) {
hash = sticker_song_list_values(song);
if (NULL == hash) {
command_error(client, ACK_ERROR_NO_EXIST, command_error(client, ACK_ERROR_NO_EXIST,
"no stickers found"); "no stickers found");
return COMMAND_RETURN_ERROR; return COMMAND_RETURN_ERROR;
} }
g_hash_table_foreach(hash, (GHFunc)print_sticker,
client); sticker_foreach(sticker, print_sticker, client);
g_hash_table_destroy(hash); sticker_free(sticker);
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
} else if (argc == 6 && strcmp(argv[1], "set") == 0) { } else if (argc == 6 && strcmp(argv[1], "set") == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment