aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-10-13 01:12:34 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2016-10-13 01:12:34 +0200
commitdfc7ff57efee0608c652f81779ef45a1b5269abf (patch)
tree71ecee476f31cbabbb585c3edcbeecc0d3421b35
parent2a15b1de700eb4e20c6bebb9742c8e20fffc9687 (diff)
downloadliberty-dfc7ff57efee0608c652f81779ef45a1b5269abf.tar.gz
liberty-dfc7ff57efee0608c652f81779ef45a1b5269abf.tar.xz
liberty-dfc7ff57efee0608c652f81779ef45a1b5269abf.zip
MPD client: support command_list_ok_begin
-rw-r--r--liberty-proto.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/liberty-proto.c b/liberty-proto.c
index 33bb29d..e99b659 100644
--- a/liberty-proto.c
+++ b/liberty-proto.c
@@ -1498,9 +1498,6 @@ mpd_client_parse_response (const char *p, struct mpd_response *response)
{
if (!strcmp (p, "OK"))
return response->success = true;
- if (!strcmp (p, "list_OK"))
- // TODO: either implement this or fail the connection properly
- hard_assert (!"command_list_ok_begin not implemented");
char *end = NULL;
if (*p++ != 'A' || *p++ != 'C' || *p++ != 'K' || *p++ != ' ' || *p++ != '[')
@@ -1574,7 +1571,9 @@ mpd_client_parse_line (struct mpd_client *self, const char *line)
struct mpd_response response;
memset (&response, 0, sizeof response);
- if (mpd_client_parse_response (line, &response))
+ if (!strcmp (line, "list_OK"))
+ str_vector_add_owned (&self->data, NULL);
+ else if (mpd_client_parse_response (line, &response))
{
mpd_client_dispatch (self, &response);
free (response.current_command);
@@ -1759,6 +1758,15 @@ mpd_client_list_begin (struct mpd_client *self)
self->in_list = true;
}
+/// Beware that "list_OK" turns into NULL values in the output vector
+static void
+mpd_client_list_ok_begin (struct mpd_client *self)
+{
+ hard_assert (!self->in_list);
+ mpd_client_send_command (self, "command_list_ok_begin", NULL);
+ self->in_list = true;
+}
+
/// End a list of commands. Remember to call mpd_client_add_task()
/// to handle the summary response.
static void