summaryrefslogtreecommitdiff
path: root/src/net_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/net_client.c')
-rw-r--r--src/net_client.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/net_client.c b/src/net_client.c
index 38e40017..379a5a78 100644
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: net_client.c 401 2006-03-01 20:02:53Z fraggle $
+// $Id: net_client.c 410 2006-03-07 12:46:52Z fraggle $
//
// Copyright(C) 2005 Simon Howard
//
@@ -143,6 +143,7 @@
// Network client code
//
+#include <ctype.h>
#include <stdlib.h>
#include <string.h>
@@ -884,6 +885,33 @@ static void NET_CL_ParseResendRequest(net_packet_t *packet)
NET_CL_SendTics(start, start + num_tics - 1);
}
+// Console message that the server wants the client to print
+
+static void NET_CL_ParseConsoleMessage(net_packet_t *packet)
+{
+ char *msg;
+ char *p;
+
+ msg = NET_ReadString(packet);
+
+ if (msg == NULL)
+ {
+ return;
+ }
+
+ // Do not do a straight "puts" of the string, as this could be
+ // dangerous (sending control codes to terminals can do all
+ // kinds of things)
+
+ for (p=msg; *p; ++p)
+ {
+ if (isprint(*p))
+ putchar(*p);
+ }
+
+ putchar('\n');
+}
+
// parse a received packet
static void NET_CL_ParsePacket(net_packet_t *packet)
@@ -919,6 +947,10 @@ static void NET_CL_ParsePacket(net_packet_t *packet)
NET_CL_ParseResendRequest(packet);
break;
+ case NET_PACKET_TYPE_CONSOLE_MESSAGE:
+ NET_CL_ParseConsoleMessage(packet);
+ break;
+
default:
break;
}