summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4a91161)
raw | patch | inline | side by side (parent: 4a91161)
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Wed, 4 Jan 2012 17:33:31 +0000 (18:33 +0100) | ||
committer | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Wed, 23 May 2012 01:50:38 +0000 (03:50 +0200) |
src/mpdclient.c | patch | blob | history | |
src/mpdclient.h | patch | blob | history |
diff --git a/src/mpdclient.c b/src/mpdclient.c
index 685d149a3cb5004dbff5d0ad02e66cd022f86c11..e55c1362482ece91917b22875f9dc9f671c339d3 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
return true;
}
+#if LIBMPDCLIENT_CHECK_VERSION(2,5,0)
+/* The client-to-client protocol (MPD 0.17.0) */
+
+bool
+mpdclient_cmd_subscribe(struct mpdclient *c, const char *channel)
+{
+ struct mpd_connection *connection = mpdclient_get_connection(c);
+
+ if (connection == NULL)
+ return false;
+
+ if (!mpd_send_subscribe(connection, channel))
+ return mpdclient_handle_error(c);
+
+ return mpdclient_finish_command(c);
+}
+
+bool
+mpdclient_cmd_unsubscribe(struct mpdclient *c, const char *channel)
+{
+ struct mpd_connection *connection = mpdclient_get_connection(c);
+ if (connection == NULL)
+ return false;
+
+ if (!mpd_send_unsubscribe(connection, channel))
+ return mpdclient_handle_error(c);
+
+ return mpdclient_finish_command(c);
+}
+
+bool
+mpdclient_cmd_send_message(struct mpdclient *c, const char *channel,
+ const char *text)
+{
+ struct mpd_connection *connection = mpdclient_get_connection(c);
+ if (connection == NULL)
+ return false;
+
+ if (!mpd_send_send_message(connection, channel, text))
+ return mpdclient_handle_error(c);
+
+ return mpdclient_finish_command(c);
+}
+
+bool
+mpdclient_send_read_messages(struct mpdclient *c)
+{
+ struct mpd_connection *connection = mpdclient_get_connection(c);
+ if (connection == NULL)
+ return false;
+
+ return mpd_send_read_messages(connection)?
+ true : mpdclient_handle_error(c);
+}
+
+struct mpd_message *
+mpdclient_recv_message(struct mpdclient *c)
+{
+ struct mpd_connection *connection = mpdclient_get_connection(c);
+ if (connection == NULL)
+ return false;
+
+ struct mpd_message *message = mpd_recv_message(connection);
+ if (message == NULL &&
+ mpd_connection_get_error(connection) != MPD_ERROR_SUCCESS)
+ mpdclient_handle_error(c);
+
+ return message;
+}
+#endif
/****************************************************************************/
/*** Playlist management functions ******************************************/
diff --git a/src/mpdclient.h b/src/mpdclient.h
index e9234805d6443f88692fb2c689c208cd11b28921..bca739b78ea025dee105c0539369875c690577d1 100644 (file)
--- a/src/mpdclient.h
+++ b/src/mpdclient.h
bool
mpdclient_cmd_move(struct mpdclient *c, unsigned dest, unsigned src);
+#if LIBMPDCLIENT_CHECK_VERSION(2,5,0)
+bool
+mpdclient_cmd_subscribe(struct mpdclient *c, const char *channel);
+
+bool
+mpdclient_cmd_unsubscribe(struct mpdclient *c, const char *channel);
+
+bool
+mpdclient_cmd_send_message(struct mpdclient *c, const char *channel,
+ const char *text);
+
+bool
+mpdclient_send_read_messages(struct mpdclient *c);
+
+struct mpd_message *
+mpdclient_recv_message(struct mpdclient *c);
+#endif
+
/*** playlist functions **************************************************/
/* update the complete playlist */