summaryrefslogtreecommitdiff
path: root/libpiano/main.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@gmail.com>2008-06-10 21:35:20 +0200
committerLars-Dominik Braun <PromyLOPh@gmail.com>2008-06-10 21:35:20 +0200
commitf531df2b04097bf24563ed4becdfca13df00de0d (patch)
tree6aea0574022d4738f6badd1c81b39a61d34b05d7 /libpiano/main.c
parent43304e940b55889cb07da3e2c29cef48cb76e5d1 (diff)
downloadpianobar-f531df2b04097bf24563ed4becdfca13df00de0d.tar.gz
pianobar-f531df2b04097bf24563ed4becdfca13df00de0d.tar.bz2
pianobar-f531df2b04097bf24563ed4becdfca13df00de0d.zip
Initial delete station implementation
Diffstat (limited to 'libpiano/main.c')
-rw-r--r--libpiano/main.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/libpiano/main.c b/libpiano/main.c
index 08ea22b..1ee3f2b 100644
--- a/libpiano/main.c
+++ b/libpiano/main.c
@@ -306,3 +306,39 @@ PianoReturn_t PianoRenameStation (PianoHandle_t *ph, PianoStation_t *station,
return ret;
}
+
+/* delete station
+ * @author PromyLOPh
+ * @added 2008-06-10
+ * @public yes
+ * @param piano handle
+ * @param station you want to delete
+ * @return
+ */
+PianoReturn_t PianoDeleteStation (PianoHandle_t *ph, PianoStation_t *station) {
+ char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE];
+ char *requestStr, *retStr;
+ PianoReturn_t ret = PIANO_RET_ERR;
+
+ snprintf (xmlSendBuf, sizeof (xmlSendBuf), "<?xml version=\"1.0\"?>"
+ "<methodCall><methodName>station.removeStation</methodName>"
+ "<params><param><value><int>%li</int></value></param>"
+ "<param><value><string>%s</string></value></param>"
+ "<param><value><string>%s</string></value></param>"
+ "</params></methodCall>", time (NULL), ph->user.authToken,
+ station->id);
+ requestStr = PianoEncryptString (xmlSendBuf);
+
+ snprintf (url, sizeof (url), PIANO_RPC_URL "rid=%s&lid=%s"
+ "&method=removeStation&arg1=%s", ph->routeId, ph->user.listenerId,
+ station->id);
+ PianoHttpPost (ph->curlHandle, url, requestStr, &retStr);
+ ret = PianoXmlParseSimple (retStr);
+
+ /* FIXME would be our job to delete station from global station list... */
+
+ free (requestStr);
+ free (retStr);
+
+ return ret;
+}