From 14691417b05401957a72ec0ed35b9eed3ddd8e87 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 6 Jan 2009 20:52:16 +0100 Subject: piano: Detect pandora's ip restriction error messages --- libpiano/src/main.c | 4 ++++ libpiano/src/piano.h | 2 +- libpiano/src/xml.c | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'libpiano') diff --git a/libpiano/src/main.c b/libpiano/src/main.c index fd0a4bc..698ce6e 100644 --- a/libpiano/src/main.c +++ b/libpiano/src/main.c @@ -868,6 +868,10 @@ const char *PianoErrorToStr (PianoReturn_t ret) { return "Station id is invalid."; break; + case PIANO_RET_IP_REJECTED: + return "Your ip address was rejected. Please setup a control " + "proxy (see manpage)."; + default: return "No error message available."; break; diff --git a/libpiano/src/piano.h b/libpiano/src/piano.h index e294b4a..a428b69 100644 --- a/libpiano/src/piano.h +++ b/libpiano/src/piano.h @@ -153,7 +153,7 @@ enum PianoReturn {PIANO_RET_OK, PIANO_RET_ERR, PIANO_RET_XML_INVALID, PIANO_RET_AUTH_TOKEN_INVALID, PIANO_RET_AUTH_USER_PASSWORD_INVALID, PIANO_RET_NET_ERROR, PIANO_RET_NOT_AUTHORIZED, PIANO_RET_PROTOCOL_INCOMPATIBLE, PIANO_RET_READONLY_MODE, - PIANO_RET_STATION_CODE_INVALID}; + PIANO_RET_STATION_CODE_INVALID, PIANO_RET_IP_REJECTED}; typedef enum PianoReturn PianoReturn_t; void PianoInit (PianoHandle_t *); diff --git a/libpiano/src/xml.c b/libpiano/src/xml.c index a07542b..9db2644 100644 --- a/libpiano/src/xml.c +++ b/libpiano/src/xml.c @@ -37,6 +37,10 @@ void PianoXmlStructParser (const xmlNode *structRoot, char *PianoXmlGetNodeText (const xmlNode *node); /* parse fault and get fault type + * @param xml content + * @param xml node + * @param return error string + * @return nothing */ void PianoXmlIsFaultCb (const char *key, const xmlNode *value, void *data) { PianoReturn_t *ret = data; @@ -82,6 +86,11 @@ void PianoXmlIsFaultCb (const char *key, const xmlNode *value, void *data) { } } } + } else if (strcmp ("faultCode", key) == 0) { + /* some error can only be identified by looking at their id */ + if (strcmp ("12", valueStr) == 0) { + *ret = PIANO_RET_IP_REJECTED; + } } } -- cgit v1.2.3