diff options
author | Kalle Wallin <kaw@linux.se> | 2004-03-29 18:09:38 +0000 |
---|---|---|
committer | Kalle Wallin <kaw@linux.se> | 2004-03-29 18:09:38 +0000 |
commit | b4c27011d20196aeeb104edb3c2e3dd97861e8d8 (patch) | |
tree | df2492d66f86e4470da2b12ae4425ee093b5677c /mpc.c | |
parent | 30327ee6f3bc929ae9f8ceca73a6b0ef8e5a0282 (diff) | |
download | mpd-b4c27011d20196aeeb104edb3c2e3dd97861e8d8.tar.gz mpd-b4c27011d20196aeeb104edb3c2e3dd97861e8d8.tar.xz mpd-b4c27011d20196aeeb104edb3c2e3dd97861e8d8.zip |
Added password support.
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@534 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'mpc.c')
-rw-r--r-- | mpc.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -63,7 +63,7 @@ mpc_close(mpd_client_t *c) } mpd_client_t * -mpc_connect(char *host, int port) +mpc_connect(char *host, int port, char *password) { mpd_Connection *connection; mpd_client_t *c; @@ -80,11 +80,17 @@ mpc_connect(char *host, int port) c->connection = connection; c->cwd = g_strdup(""); + if( password ) + { + mpd_sendPasswordCommand(connection, password); + mpd_finishCommand(connection); + } + return c; } int -mpc_reconnect(mpd_client_t *c, char *host, int port) +mpc_reconnect(mpd_client_t *c, char *host, int port, char *password) { mpd_Connection *connection; @@ -99,6 +105,12 @@ mpc_reconnect(mpd_client_t *c, char *host, int port) c->connection = connection; + if( password ) + { + mpd_sendPasswordCommand(connection, password); + mpd_finishCommand(connection); + } + return 0; } @@ -109,7 +121,7 @@ mpc_error(mpd_client_t *c) if( c == NULL || c->connection == NULL ) return 1; if( c->connection->error ) - return 1; + return c->connection->error; return 0; } |