From 461b40409991eb74fc754cc9c9d7c37efddf8d84 Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 2 May 2008 11:09:57 +0000 Subject: [PATCH] sanitize nicknames that start with a 0x01 or 0x02 (chat beep) by adding an extra ^7 at the beginning git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8270 d7cf8633-e32d-0410-b094-e92efae38249 --- host_cmd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/host_cmd.c b/host_cmd.c index 5a8db28a..1768dbc4 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -767,6 +767,15 @@ void Host_Name_f (void) host_client->name[j++] = host_client->name[i]; host_client->name[j] = 0; + if(host_client->name[0] == 1 || host_client->name[0] == 2) + // may interfere with chat area, and will needlessly beep; so let's add a ^7 + { + memmove(host_client->name + 2, host_client->name, sizeof(host_client->name) - 2); + host_client->name[sizeof(host_client->name) - 1] = 0; + host_client->name[0] = STRING_COLOR_TAG; + host_client->name[1] = '0' + STRING_COLOR_DEFAULT; + } + COM_StringLengthNoColors(host_client->name, 0, &valid_colors); if(!valid_colors) // NOTE: this also proves the string is not empty, as "" is a valid colored string { -- 2.39.2