[mw-devel] MW3 r1214 - in trunk: src/webclient webclient
tswsl1989 at sucs.org
tswsl1989 at sucs.org
Sun Oct 10 15:05:19 BST 2010
Author: tswsl1989
Date: 2010-10-10 15:05:18 +0100 (Sun, 10 Oct 2010)
New Revision: 1214
Modified:
trunk/src/webclient/comms.c
trunk/webclient/say.js
Log:
Add support for changing room and sending messages to people with global turned on
Modified: trunk/src/webclient/comms.c
===================================================================
--- trunk/src/webclient/comms.c 2010-10-10 12:37:30 UTC (rev 1213)
+++ trunk/src/webclient/comms.c 2010-10-10 14:05:18 UTC (rev 1214)
@@ -379,7 +379,14 @@
return 0; // dont close
}else
if (strncasecmp(buff, "channel ", 8)==0) {
+ struct filter_info f_info;
+ char line[8192];
user->room = atoi(&buff[8]);
+ memset(&f_info, 0, sizeof(f_info));
+ f_info.channel = user->room;
+ snprintf(line, sizeof line, "\03310%s has just arrived in room %d", user->name, user->room);
+ ipc_send_to_all(IPC_TEXT, line, send_filter_oneroom, &f_info);
+ ipc_send_to_all(IPC_TEXT, line, send_filter_global, &f_info);
snprintf(buff, sizeof buff, "{\"channel\":%d}", user->room);
send(co->fd, buff, strlen(buff), 0);
return 0; // dont close
@@ -416,6 +423,10 @@
f_info.channel = user->room;
snprintf(line, sizeof line, "%s %s", user->name, &buff[6]);
ipc_send_to_all(IPC_TEXT, line, send_filter_oneroom, &f_info);
+ //Strictly speaking, the following should check whether or not the room is hidden.
+ //If anyone cares about it enough to fix it, go right ahead
+ snprintf(line, MAXTEXTLENGTH, "%d:%s %s", user->room, user->name, &buff[6]);
+ ipc_send_to_all(IPC_TEXT, line, send_filter_global, &f_info);
snprintf(buff, sizeof buff, "{\"status\":\"Emote Sent to channel %d\"}", user->room);
send(co->fd, buff, strlen(buff), 0);
return 1;
@@ -501,6 +512,10 @@
f_info.channel = user->room;
snprintf(line, sizeof line, "%s: %s", user->name, &buff[4]);
ipc_send_to_all(IPC_TEXT, line, send_filter_oneroom, &f_info);
+ //Strictly speaking, the following should check whether or not the room is hidden.
+ //If anyone cares about it enough to fix it, go right ahead
+ snprintf(line, MAXTEXTLENGTH, "%d:%s: %s", user->room, user->name, &buff[4]);
+ ipc_send_to_all(IPC_TEXT, line, send_filter_global, &f_info);
snprintf(buff, sizeof buff, "{\"status\":\"Message Sent to channel %d\"}", user->room);
send(co->fd, buff, strlen(buff), 0);
return 1;
Modified: trunk/webclient/say.js
===================================================================
--- trunk/webclient/say.js 2010-10-10 12:37:30 UTC (rev 1213)
+++ trunk/webclient/say.js 2010-10-10 14:05:18 UTC (rev 1214)
@@ -143,6 +143,9 @@
case "who":
sendCmdHandle('who', drawWho);
break;
+ case "room":
+ sendCmd('channel '+args);
+ break;
case "e":
case "em":
case "emote":
More information about the mw-devel
mailing list