From 4fcf27be6d3d1354d510b6a774805cd3165db6c3 Mon Sep 17 00:00:00 2001 From: jcorporation Date: Sun, 3 Nov 2024 09:33:22 +0100 Subject: [PATCH] Support "tagtypes reset" command (MPD 0.24) --- include/mpd/capabilities.h | 25 +++++++++++++++++++++++++ libmpdclient.ld | 2 ++ src/capabilities.c | 15 +++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/include/mpd/capabilities.h b/include/mpd/capabilities.h index 3ec1282..262e04c 100644 --- a/include/mpd/capabilities.h +++ b/include/mpd/capabilities.h @@ -218,6 +218,31 @@ mpd_send_all_tag_types(struct mpd_connection *connection); bool mpd_run_all_tag_types(struct mpd_connection *connection); +/** + * Clear the list of tag types and re-enable one or more tags from + * the list of tag types for this client. These will no longer be + * hidden from responses to this client. + * + * @param connection the connection to MPD + * @param types an array of tag types to enable + * @param n the number of tag types in the array + * @return true on success, false on error + * + * @since libmpdclient 2.23, MPD 0.24 + */ +bool +mpd_send_reset_tag_types(struct mpd_connection *connection, + const enum mpd_tag_type *types, unsigned n); + +/** + * Shortcut for mpd_send_reset_tag_types() and mpd_response_finish(). + * + * @since libmpdclient 2.23, MPD 0.24 + */ +bool +mpd_run_reset_tag_types(struct mpd_connection *connection, + const enum mpd_tag_type *types, unsigned n); + /** * Requests a list of enabled protocol features. * Use mpd_recv_protocol_feature_pair() to obtain the list of diff --git a/libmpdclient.ld b/libmpdclient.ld index a7fcec9..db97561 100644 --- a/libmpdclient.ld +++ b/libmpdclient.ld @@ -28,6 +28,8 @@ global: mpd_run_clear_tag_types; mpd_send_all_tag_types; mpd_run_all_tag_types; + mpd_send_reset_tag_types; + mpd_run_reset_tag_types; mpd_send_list_protocol_features; mpd_send_list_protocol_features_available; mpd_recv_protocol_feature_pair; diff --git a/src/capabilities.c b/src/capabilities.c index dd62707..7a91e72 100644 --- a/src/capabilities.c +++ b/src/capabilities.c @@ -135,6 +135,21 @@ mpd_run_all_tag_types(struct mpd_connection *connection) mpd_response_finish(connection); } +bool +mpd_send_reset_tag_types(struct mpd_connection *connection, + const enum mpd_tag_type *types, unsigned n) +{ + return mpd_send_tag_types_v(connection, "reset", types, n); +} + +bool +mpd_run_reset_tag_types(struct mpd_connection *connection, + const enum mpd_tag_type *types, unsigned n) +{ + return mpd_send_reset_tag_types(connection, types, n) && + mpd_response_finish(connection); +} + bool mpd_send_list_protocol_features(struct mpd_connection *connection) {