]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
sanitize nicknames that start with a 0x01 or 0x02 (chat beep) by adding an extra...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 2 May 2008 11:09:57 +0000 (11:09 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 2 May 2008 11:09:57 +0000 (11:09 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8270 d7cf8633-e32d-0410-b094-e92efae38249

host_cmd.c

index 5a8db28a0e16f1af1a5a80205d542d6e04380a72..1768dbc44d244c8cb25b1f45216f3e160b24ccb8 100644 (file)
@@ -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
        {