aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-08-07 22:03:08 +0200
committerPřemysl Eric Janouch <p@janouch.name>2024-08-07 22:03:08 +0200
commite78b410a6afff53d61a4caf9c6e76fb995e0bc76 (patch)
tree8bfef407fc08fd727774905ace00235bbe8c9d0b
parentbf44e827e862c3ae7a05d01c7a2478fc8684d96c (diff)
downloadliberty-e78b410a6afff53d61a4caf9c6e76fb995e0bc76.tar.gz
liberty-e78b410a6afff53d61a4caf9c6e76fb995e0bc76.tar.xz
liberty-e78b410a6afff53d61a4caf9c6e76fb995e0bc76.zip
MPD client: save the protocol version
-rw-r--r--liberty-proto.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/liberty-proto.c b/liberty-proto.c
index 7c884e9..577fcda 100644
--- a/liberty-proto.c
+++ b/liberty-proto.c
@@ -1381,7 +1381,7 @@ struct mpd_client
// Protocol:
- bool got_hello; ///< Got the OK MPD hello message
+ char *got_hello; ///< Version from OK MPD hello message
bool idling; ///< Sent idle as the last command
unsigned idling_subsystems; ///< Subsystems we're idling for
@@ -1482,7 +1482,7 @@ mpd_client_reset (struct mpd_client *self)
str_reset (&self->read_buffer);
str_reset (&self->write_buffer);
- self->got_hello = false;
+ cstr_set (&self->got_hello, NULL);
self->idling = false;
self->idling_subsystems = 0;
self->in_list = false;
@@ -1549,7 +1549,8 @@ mpd_client_parse_hello (struct mpd_client *self, const char *line)
// TODO: call "on_connected" now. We should however also set up a timer
// so that we don't wait on this message forever.
- return self->got_hello = true;
+ cstr_set (&self->got_hello, xstrdup (line + sizeof hello - 1));
+ return true;
}
static bool