summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 520e0c2)
raw | patch | inline | side by side (parent: 520e0c2)
author | Max Kellermann <max@duempel.org> | |
Thu, 10 Sep 2009 15:52:32 +0000 (17:52 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 10 Sep 2009 15:52:32 +0000 (17:52 +0200) |
src/mpdclient.c | patch | blob | history |
diff --git a/src/mpdclient.c b/src/mpdclient.c
index a4224a68cd3183ffe8826aa0f1e9af11f3269e13..42cc576d3a31e297543f27b371f77d372a1df015 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
/*** mpdclient functions ****************************************************/
/****************************************************************************/
-gint
-mpdclient_finish_command(mpdclient_t *c)
+static gint
+mpdclient_handle_error(mpdclient_t *c)
{
- mpd_finishCommand(c->connection);
+ enum mpd_error error = c->connection->error;
- if (c->connection->error) {
- gint error = c->connection->error;
+ if (error == MPD_ERROR_SUCCESS)
+ return 0;
- if (error == MPD_ERROR_ACK &&
- c->connection->errorCode == MPD_ACK_ERROR_PERMISSION &&
- screen_auth(c) == 0)
- return 0;
+ if (error == MPD_ERROR_ACK &&
+ c->connection->errorCode == MPD_ACK_ERROR_PERMISSION &&
+ screen_auth(c) == 0)
+ return 0;
- if (error == MPD_ERROR_ACK)
- error = error | (c->connection->errorCode << 8);
+ if (error == MPD_ERROR_ACK)
+ error = error | (c->connection->errorCode << 8);
- error_cb(c, error, c->connection->errorStr);
- return error;
- }
+ error_cb(c, error, c->connection->errorStr);
+ return error;
+}
- return 0;
+gint
+mpdclient_finish_command(mpdclient_t *c)
+{
+ mpd_finishCommand(c->connection);
+ return mpdclient_handle_error(c);
}
mpdclient_t *