From f531df2b04097bf24563ed4becdfca13df00de0d Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 10 Jun 2008 21:35:20 +0200 Subject: Initial delete station implementation --- libpiano/main.c | 36 ++++++++++++++++++++++++++++++++++++ libpiano/piano.h | 1 + 2 files changed, 37 insertions(+) (limited to 'libpiano') 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), "" + "station.removeStation" + "%li" + "%s" + "%s" + "", 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; +} diff --git a/libpiano/piano.h b/libpiano/piano.h index 030b942..ebb7f55 100644 --- a/libpiano/piano.h +++ b/libpiano/piano.h @@ -133,5 +133,6 @@ PianoReturn_t PianoRateTrack (PianoHandle_t *ph, PianoStation_t *station, PianoSong_t *song, PianoSongRating_t rating); PianoReturn_t PianoRenameStation (PianoHandle_t *ph, PianoStation_t *station, char *newName); +PianoReturn_t PianoDeleteStation (PianoHandle_t *ph, PianoStation_t *station); #endif /* _PIANO_H */ -- cgit v1.2.3