diff --git a/src/mpdclient.c b/src/mpdclient.c
index 7bf29ea921e20dbda7aae906e7754aaf979e1f20..ce1eed5972de92bda9ef4db76a0aa7682d60dc92 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
return false;
}
-static bool
-mpdclient_finish_command(struct mpdclient *c)
-{
- return mpd_response_finish(c->connection)
- ? true : mpdclient_handle_error(c);
-}
-
struct mpdclient *
mpdclient_new(void)
{
c->song = NULL;
/* everything has changed after a disconnect */
- c->events |= MPD_IDLE_DATABASE|MPD_IDLE_STORED_PLAYLIST|
- MPD_IDLE_QUEUE|MPD_IDLE_PLAYER|MPD_IDLE_MIXER|MPD_IDLE_OUTPUT|
- MPD_IDLE_OPTIONS|MPD_IDLE_UPDATE;
+ c->events |= MPD_IDLE_ALL;
}
bool
mpdclient_connect(struct mpdclient *c,
const gchar *host,
gint port,
- gfloat _timeout,
+ unsigned timeout_ms,
const gchar *password)
{
/* close any open connection */
- if( c->connection )
+ if (c->connection)
mpdclient_disconnect(c);
/* connect to MPD */
- c->connection = mpd_connection_new(host, port, _timeout * 1000);
+ c->connection = mpd_connection_new(host, port, timeout_ms);
if (c->connection == NULL)
g_error("Out of memory");
reducing the UI latency */
playlist_clear(&c->playlist);
c->playlist.version = mpd_status_get_queue_version(status);
+ c->song = NULL;
}
c->events |= MPD_IDLE_QUEUE;
if (connection == NULL)
return false;
- mpd_send_add(connection, path_utf8);
- return mpdclient_finish_command(c);
+ return mpd_send_add(connection, path_utf8)?
+ mpdclient_finish_command(c) : false;
}
bool