[nexuiz-commits] r8424 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Dec 19 13:22:56 EST 2009


Author: div0
Date: 2009-12-19 13:22:46 -0500 (Sat, 19 Dec 2009)
New Revision: 8424

Modified:
   trunk/data/qcsrc/server/ipban.qc
Log:
support other URL parameters in g_ban_sync_uri (i.e. extend URI by &, not ?, if ? already exists)


Modified: trunk/data/qcsrc/server/ipban.qc
===================================================================
--- trunk/data/qcsrc/server/ipban.qc	2009-12-19 17:37:53 UTC (rev 8423)
+++ trunk/data/qcsrc/server/ipban.qc	2009-12-19 18:22:46 UTC (rev 8424)
@@ -26,7 +26,7 @@
 	string uri;
 	float i, n;
 
-	uri = strcat(     "?action=ban&hostname=", uri_escape(cvar_string("hostname")));
+	uri = strcat(     "action=ban&hostname=", uri_escape(cvar_string("hostname")));
 	uri = strcat(uri, "&ip=", uri_escape(ip));
 	uri = strcat(uri, "&duration=", ftos(bantime));
 	uri = strcat(uri, "&reason=", uri_escape(reason));
@@ -35,7 +35,12 @@
 	if(n >= MAX_IPBAN_URIS)
 		n = MAX_IPBAN_URIS;
 	for(i = 0; i < n; ++i)
-		uri_get(strcat(argv(i), uri), URI_GET_DISCARD); // 0 = "discard" callback target
+	{
+		if(strstrofs(argv(i), "?", 0) >= 0)
+			uri_get(strcat(argv(i), "&", uri), URI_GET_DISCARD); // 0 = "discard" callback target
+		else
+			uri_get(strcat(argv(i), "?", uri), URI_GET_DISCARD); // 0 = "discard" callback target
+	}
 }
 
 void OnlineBanList_SendUnban(string ip)
@@ -43,14 +48,19 @@
 	string uri;
 	float i, n;
 
-	uri = strcat(     "?action=unban&hostname=", uri_escape(cvar_string("hostname")));
+	uri = strcat(     "action=unban&hostname=", uri_escape(cvar_string("hostname")));
 	uri = strcat(uri, "&ip=", uri_escape(ip));
 
 	n = tokenize_console(cvar_string("g_ban_sync_uri"));
 	if(n >= MAX_IPBAN_URIS)
 		n = MAX_IPBAN_URIS;
 	for(i = 0; i < n; ++i)
-		uri_get(strcat(argv(i), uri), URI_GET_DISCARD); // 0 = "discard" callback target
+	{
+		if(strstrofs(argv(i), "?", 0) >= 0)
+			uri_get(strcat(argv(i), "&", uri), URI_GET_DISCARD); // 0 = "discard" callback target
+		else
+			uri_get(strcat(argv(i), "?", uri), URI_GET_DISCARD); // 0 = "discard" callback target
+	}
 }
 
 string OnlineBanList_Servers;
@@ -194,7 +204,7 @@
 		OnlineBanList_Servers = strcat(OnlineBanList_Servers, ";", argv(i));
 	OnlineBanList_Servers = strzone(OnlineBanList_Servers);
 	
-	uri = strcat(     "?action=list&hostname=", uri_escape(cvar_string("hostname")));
+	uri = strcat(     "action=list&hostname=", uri_escape(cvar_string("hostname")));
 	uri = strcat(uri, "&servers=", uri_escape(OnlineBanList_Servers));
 
 	OnlineBanList_Timeout = time + cvar("g_ban_sync_timeout");
@@ -207,7 +217,10 @@
 		if(OnlineBanList_RequestWaiting[i])
 			continue;
 		OnlineBanList_RequestWaiting[i] = 1;
-		uri_get(strcat(argv(i), uri), URI_GET_IPBAN + i); // 1000 = "banlist" callback target
+		if(strstrofs(argv(i), "?", 0) >= 0)
+			uri_get(strcat(argv(i), "&", uri), URI_GET_IPBAN + i); // 1000 = "banlist" callback target
+		else
+			uri_get(strcat(argv(i), "?", uri), URI_GET_IPBAN + i); // 1000 = "banlist" callback target
 	}
 	
 	if(cvar("g_ban_sync_interval") > 0)



More information about the nexuiz-commits mailing list