summaryrefslogtreecommitdiff
path: root/libpiano
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2009-01-06 20:52:16 +0100
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2009-01-06 20:52:16 +0100
commit14691417b05401957a72ec0ed35b9eed3ddd8e87 (patch)
tree66fc948874eef34da3b2a001acebf7604a1fbe9c /libpiano
parent785819ed369fae59aef20a09779eaa0a627a8709 (diff)
downloadpianobar-14691417b05401957a72ec0ed35b9eed3ddd8e87.tar.gz
pianobar-14691417b05401957a72ec0ed35b9eed3ddd8e87.tar.bz2
pianobar-14691417b05401957a72ec0ed35b9eed3ddd8e87.zip
piano: Detect pandora's ip restriction error messages
Diffstat (limited to 'libpiano')
-rw-r--r--libpiano/src/main.c4
-rw-r--r--libpiano/src/piano.h2
-rw-r--r--libpiano/src/xml.c9
3 files changed, 14 insertions, 1 deletions
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 <name> content
+ * @param xml <value> 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;
+ }
}
}