diff --git a/src/mpdclient.c b/src/mpdclient.c
index 6e6dd9948f6fa218e261246c7510ead26adac537..73bb85f337c5679092e07e7526066fa36861676b 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
mpdclient_invoke_error_callback(error,
mpd_connection_get_error_message(c->connection));
- if (!mpd_connection_clear_error(c->connection))
+ if (!mpd_connection_clear_error(c->connection)) {
mpdclient_disconnect(c);
+ mpdclient_lost_callback();
+ }
return false;
}
bool
mpdclient_cmd_volume_up(struct mpdclient *c)
{
+ if (c->volume < 0 || c->volume >= 100)
+ return true;
+
struct mpd_connection *connection = mpdclient_get_connection(c);
if (connection == NULL)
return false;
- if (c->status == NULL ||
- mpd_status_get_volume(c->status) == -1)
- return true;
-
- if (c->volume < 0)
- c->volume = mpd_status_get_volume(c->status);
-
- if (c->volume >= 100)
- return true;
-
return mpdclient_cmd_volume(c, ++c->volume);
}
bool
mpdclient_cmd_volume_down(struct mpdclient *c)
{
+ if (c->volume <= 0)
+ return true;
+
struct mpd_connection *connection = mpdclient_get_connection(c);
if (connection == NULL)
return false;
- if (c->status == NULL || mpd_status_get_volume(c->status) < 0)
- return true;
-
- if (c->volume < 0)
- c->volume = mpd_status_get_volume(c->status);
-
- if (c->volume <= 0)
- return true;
-
return mpdclient_cmd_volume(c, --c->volume);
}