summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e8c92fd)
raw | patch | inline | side by side (parent: e8c92fd)
author | Max Kellermann <max@duempel.org> | |
Tue, 29 Sep 2009 18:36:07 +0000 (20:36 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Tue, 29 Sep 2009 18:36:07 +0000 (20:36 +0200) |
true for success, false for error.
src/mpdclient.c | patch | blob | history | |
src/screen_client.c | patch | blob | history | |
src/screen_client.h | patch | blob | history |
diff --git a/src/mpdclient.c b/src/mpdclient.c
index 1434d172acd62f926c1acd630d455a3f2d62a6d0..6eb41448264c056ae38dfaa21de25d8807f0087d 100644 (file)
--- a/src/mpdclient.c
+++ b/src/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 397a7cb474658b958b9a7abc9004f2cfdadff21c..7583e8a15e476d434a6f1c62dd507ee483acdf48 100644 (file)
--- a/src/screen_client.c
+++ b/src/screen_client.c
#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);
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 73e90d523cb58c61b5fb4b8eb7750c4a33b02873..9b419d148e175ddf84b86de383e56f95217cab9b 100644 (file)
--- a/src/screen_client.h
+++ b/src/screen_client.h
#ifndef NCMPC_SCREEN_CLIENT_H
#define NCMPC_SCREEN_CLIENT_H
-#include <glib.h>
+#include <stdbool.h>
struct mpdclient;
-gint
+bool
screen_auth(struct mpdclient *c);
#endif