[xiph-commits] r8476 - trunk/icecast2yp/src

oddsock at motherfish-iii.xiph.org oddsock at motherfish-iii.xiph.org
Fri Dec 17 10:55:53 PST 2004


Author: oddsock
Date: 2004-12-17 10:55:52 -0800 (Fri, 17 Dec 2004)
New Revision: 8476

Modified:
   trunk/icecast2yp/src/yp_cgi.c
   trunk/icecast2yp/src/yp_routines.c
   trunk/icecast2yp/src/yp_routines.h
Log:
allow server subtype to be updated on a touch


Modified: trunk/icecast2yp/src/yp_cgi.c
===================================================================
--- trunk/icecast2yp/src/yp_cgi.c	2004-12-17 14:52:36 UTC (rev 8475)
+++ trunk/icecast2yp/src/yp_cgi.c	2004-12-17 18:55:52 UTC (rev 8476)
@@ -375,7 +375,7 @@
 				sendYPResponse(0, "SID blank", ICECAST2_RESPONSE);
 				goto endofcall;
 			}
-			ret = touchServer(sid, listing_ip, cluster_password, st, listeners, "", "", "", "", "", "", error, NORMAL_TOUCH);
+			ret = touchServer(sid, listing_ip, cluster_password, st, listeners, "", "", "", "", server_subtype, "", "", error, NORMAL_TOUCH);
 			if (ret == YP_TOUCHED) {
 				Log(LOG_INFO, "YP_TOUCH successfull sid (%s)", sid);
 				sendYPResponse(1, "Successfull Touch", ICECAST2_RESPONSE);

Modified: trunk/icecast2yp/src/yp_routines.c
===================================================================
--- trunk/icecast2yp/src/yp_routines.c	2004-12-17 14:52:36 UTC (rev 8475)
+++ trunk/icecast2yp/src/yp_routines.c	2004-12-17 18:55:52 UTC (rev 8476)
@@ -825,7 +825,7 @@
 }
 
 
-int touchServer(char *sid, char *touchip, char *cluster_password, char *song, char *listeners, char *genre, char *desc, char *listenurl, char *server_type, char *bitrate, char *server_name, char *error, int touchType)
+int touchServer(char *sid, char *touchip, char *cluster_password, char *song, char *listeners, char *genre, char *desc, char *listenurl, char *server_type, char *server_subtype, char *bitrate, char *server_name, char *error, int touchType)
 {
 	char	sql[8096];
 	int	i;
@@ -836,6 +836,7 @@
 	char	*genre_esc = NULL;
 	char	*listenurl_esc = NULL;
 	char	*server_type_esc = NULL;
+	char	*server_subtype_esc = NULL;
 	char	*bitrate_esc = NULL;
 	char	*desc_esc = NULL;
 	char	*server_name_esc = NULL;
@@ -879,7 +880,11 @@
 		memset(song_esc, '\000', strlen(song)*2 + 1);
 		mysql_real_escape_string(&dbase, song_esc, song, strlen(song));
 
-		sprintf(sql,"update server_details set current_song = \'%s\', listeners = %d where id = %s", song_esc, atol(listeners), detail_id);
+		server_subtype_esc = malloc(strlen(server_subtype)*2 + 1);
+		memset(server_subtype_esc, '\000', strlen(server_subtype)*2 + 1);
+		mysql_real_escape_string(&dbase, server_subtype_esc, server_subtype, strlen(server_subtype));
+
+		sprintf(sql,"update server_details set current_song = \'%s\', server_subtype = \'%s\', listeners = %d where id = %s", song_esc, server_subtype_esc, atol(listeners), detail_id);
 	
 		Log(LOG_DEBUG, sql);
 		if (mysql_real_query(&dbase,sql,strlen(sql))) {
@@ -963,6 +968,9 @@
 		if (server_type_esc) {
 			free(server_type_esc);
 		}
+		if (server_subtype_esc) {
+			free(server_subtype_esc);
+		}
 		if (bitrate_esc) {
 			free(bitrate_esc);
 		}

Modified: trunk/icecast2yp/src/yp_routines.h
===================================================================
--- trunk/icecast2yp/src/yp_routines.h	2004-12-17 14:52:36 UTC (rev 8475)
+++ trunk/icecast2yp/src/yp_routines.h	2004-12-17 18:55:52 UTC (rev 8476)
@@ -32,7 +32,7 @@
 int genSID(char *sid, char *error);
 int connectToDB() ;
 int addServer(char *server_name, char *genre, char *cluster_password, char *desc, char *url, char *listenurl, char *server_type, char *server_subtype, char *bitrate, char *listing_ip, char *sid, char *samplerate, char *channels, char *error);
-int touchServer(char *sid, char *touchip, char *cluster_password, char *song, char *listeners, char *genre, char *desc, char *listenurl, char *server_type, char *bitrate, char *server_name, char *error, int touchType);
+int touchServer(char *sid, char *touchip, char *cluster_password, char *song, char *listeners, char *genre, char *desc, char *listenurl, char *server_type, char *server_subtype, char *bitrate, char *server_name, char *error, int touchType);
 int removeServer(char *sid, char *removeip, char *cluster_password, char *error);
 void sendOK();
 void sendHTML(char *html);



More information about the commits mailing list