[mw-devel] MW3 r1177 - trunk/src/webclient

arthur at sucs.org arthur at sucs.org
Wed Oct 6 20:52:42 BST 2010


Author: arthur
Date: 2010-10-06 20:52:42 +0100 (Wed, 06 Oct 2010)
New Revision: 1177

Modified:
   trunk/src/webclient/comms.c
   trunk/src/webclient/mwpoll.c
Log:
fix the json seperator for multiple items


Modified: trunk/src/webclient/comms.c
===================================================================
--- trunk/src/webclient/comms.c	2010-10-06 15:36:30 UTC (rev 1176)
+++ trunk/src/webclient/comms.c	2010-10-06 19:52:42 UTC (rev 1177)
@@ -289,10 +289,15 @@
 		if (strlen(tmp->text)+64 > sizeof(buff)-len) break;
 
 		/* its okay, go ahead */
-		list_del(pos);
 
 		snprintf(&buff[len], sizeof(buff)-len, "{\"state\":%d,\"pid\":%d,\"username\":\"%s\",\"text\":\"%s\"}", tmp->state, tmp->pid, tmp->user.name, tmp->text);
+		if (pos->next != &msglist) {
+			len = strlen(buff);
+			snprintf(&buff[len], sizeof(buff)-len, ",");
+		}
 
+		list_del(pos);
+
 		if (tmp->state == IPC_KICK) die=3;
 		free(tmp->text);
 		free(tmp);

Modified: trunk/src/webclient/mwpoll.c
===================================================================
--- trunk/src/webclient/mwpoll.c	2010-10-06 15:36:30 UTC (rev 1176)
+++ trunk/src/webclient/mwpoll.c	2010-10-06 19:52:42 UTC (rev 1177)
@@ -149,7 +149,7 @@
 
 	/* spock, announce us please... */
 	//broadcast_onoffcode(3, 0, user->name, NULL);
-	talk_rawbcast("\03310%s has just joined web talker room %d", user->name);
+	talk_rawbcast("\03310%s has just joined web talker room %d", user->name, user->room);
 	broadcast_onoffcode(1, 0, user->name, NULL);
 
 	/* the main loop */




More information about the mw-devel mailing list