[mw-devel] MW3 r1182 - trunk/src/webclient
arthur at sucs.org
arthur at sucs.org
Thu Oct 7 20:22:16 BST 2010
Author: arthur
Date: 2010-10-07 20:22:16 +0100 (Thu, 07 Oct 2010)
New Revision: 1182
Modified:
trunk/src/webclient/comms.c
Log:
fix the who listing sender
Modified: trunk/src/webclient/comms.c
===================================================================
--- trunk/src/webclient/comms.c 2010-10-07 19:21:35 UTC (rev 1181)
+++ trunk/src/webclient/comms.c 2010-10-07 19:22:16 UTC (rev 1182)
@@ -389,6 +389,7 @@
int ufile, wfile;
int32_t now = time(NULL);
mwstring *line = mws_new(2048);
+ int count=0;
wfile = openwhofile(O_RDONLY);
ufile = openuserfile(O_RDONLY);
@@ -402,7 +403,7 @@
if (w.posn < 0) continue;
lseek(ufile, w.posn, SEEK_SET);
read(ufile, &u, sizeof(u));
- if (mws_cstr(line)[0] != '[') mws_add(line, ",");
+ if (count > 0) mws_add(line, ",");
realname = json_escape(u.realname);
doing = json_escape(u.doing);
mws_add(line, "{");
@@ -416,10 +417,12 @@
mws_add(line, "\"idle\":%d}", now - u.idletime);
free(realname);
free(doing);
+ count++;
}
mws_add(line, "]");
send(co->fd, mws_cstr(line), mws_len(line), 0);
mws_free(line);
+ return 1;
}else
if (co->authd && strncasecmp(buff, "say ", 4)==0) {
struct filter_info f_info;
More information about the mw-devel
mailing list