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

arthur at sucs.org arthur at sucs.org
Sat Feb 2 16:40:44 GMT 2013


Author: arthur
Date: 2013-02-02 16:40:44 +0000 (Sat, 02 Feb 2013)
New Revision: 1327

Modified:
   trunk/src/webclient/comms.c
Log:
send fourcc code state types as their string not integer for ease of parsing.

say.js needs updating to notice these and parse the new format messages


Modified: trunk/src/webclient/comms.c
===================================================================
--- trunk/src/webclient/comms.c	2013-01-19 22:06:50 UTC (rev 1326)
+++ trunk/src/webclient/comms.c	2013-02-02 16:40:44 UTC (rev 1327)
@@ -284,7 +284,12 @@
 	list_for_each_safe(pos, q, &msglist) {
 		tmp = list_entry(pos, MESG, list);
 
-		mws_add(buff, "{\"state\":%d,\"pid\":%d,\"username\":\"%s\",\"text\":\"%s\"}", tmp->state, tmp->pid, tmp->user.name, tmp->text);
+		mws_add(buff, "{");
+		if (tmp->state >= 32) /* send new codes as the fourcc string */
+			mws_add(buff, "\"state\":\"%4.4s\",", (char *)&(tmp->state));
+		else
+			mws_add(buff, "\"state\":%d,", tmp->state);
+		mws_add(buff, "\"pid\":%d,\"username\":\"%s\",\"text\":\"%s\"}", tmp->pid, tmp->user.name, tmp->text);
 		if (pos->next != &msglist) {
 			mws_add(buff, ",");
 		}




More information about the mw-devel mailing list