From: Max Kellermann Date: Tue, 29 Sep 2009 18:36:07 +0000 (+0200) Subject: screen_client: screen_auth() returns bool X-Git-Tag: release-0.16~307 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9f08e1a604c2b9ee09c949fd1826ab82a08aecfb;p=ncmpc.git screen_client: screen_auth() returns bool true for success, false for error. --- diff --git a/src/mpdclient.c b/src/mpdclient.c index 1434d17..6eb4144 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -112,7 +112,7 @@ mpdclient_handle_error(struct mpdclient *c) if (error == MPD_ERROR_SERVER && mpd_connection_get_server_error(c->connection) == MPD_SERVER_ERROR_PERMISSION && - screen_auth(c) == 0) + screen_auth(c)) return 0; if (error == MPD_ERROR_SERVER) diff --git a/src/screen_client.c b/src/screen_client.c index 397a7cb..7583e8a 100644 --- a/src/screen_client.c +++ b/src/screen_client.c @@ -21,18 +21,18 @@ #include "screen_utils.h" #include "mpdclient.h" -static gint +static bool _screen_auth(struct mpdclient *c, gint recursion) { char *password; mpd_connection_clear_error(c->connection); if (recursion > 2) - return 1; + return false; password = screen_read_password(NULL, NULL); if (password == NULL) - return 1; + return false; mpd_send_password(c->connection, password); g_free(password); @@ -43,10 +43,11 @@ _screen_auth(struct mpdclient *c, gint recursion) if (mpd_connection_get_error(c->connection) == MPD_ERROR_SERVER && mpd_connection_get_server_error(c->connection) == MPD_SERVER_ERROR_PASSWORD) return _screen_auth(c, ++recursion); - return 0; + + return true; } -gint +bool screen_auth(struct mpdclient *c) { return _screen_auth(c, 0); diff --git a/src/screen_client.h b/src/screen_client.h index 73e90d5..9b419d1 100644 --- a/src/screen_client.h +++ b/src/screen_client.h @@ -20,11 +20,11 @@ #ifndef NCMPC_SCREEN_CLIENT_H #define NCMPC_SCREEN_CLIENT_H -#include +#include struct mpdclient; -gint +bool screen_auth(struct mpdclient *c); #endif