mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2025-03-23 17:31:06 +00:00
filter patch to remove \r and \n from people's names in the server
This commit is contained in:
parent
558d27134a
commit
ef8e59610a
2 changed files with 18 additions and 1 deletions
|
@ -81,6 +81,9 @@ cvar_t pausable = {"pausable","1"};
|
|||
|
||||
cvar_t temp1 = {"temp1","0"};
|
||||
|
||||
/* PHS 02/01/2000 */
|
||||
/* Should server filter out \n & \r in player names ? */
|
||||
cvar_t sv_filter = {"sv_filter","1"};
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -229,6 +232,7 @@ void Host_InitLocal (void)
|
|||
Cvar_RegisterVariable (&pausable);
|
||||
|
||||
Cvar_RegisterVariable (&temp1);
|
||||
Cvar_RegisterVariable (&sv_filter);
|
||||
|
||||
Host_FindMaxClients ();
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
extern cvar_t pausable;
|
||||
|
||||
/* PHS 02/01/2000 */
|
||||
extern cvar_t sv_filter;
|
||||
|
||||
int current_skill;
|
||||
|
||||
void Mod_Print (void);
|
||||
|
@ -910,6 +913,7 @@ Host_Name_f
|
|||
void Host_Name_f (void)
|
||||
{
|
||||
char *newName;
|
||||
int Idx;
|
||||
|
||||
if (Cmd_Argc () == 1)
|
||||
{
|
||||
|
@ -932,7 +936,16 @@ void Host_Name_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (host_client->name[0] && strcmp(host_client->name, "unconnected") )
|
||||
/* PHS 02/01/2000 */
|
||||
/* If cvar sv_filter is 1 */
|
||||
/* Check for \n & \r in names and remove, replace with '-' */
|
||||
|
||||
if(sv_filter.value == 1)
|
||||
for(Idx=0;Idx<strlen(newName);Idx++)
|
||||
if((newName[Idx]=='\r') || (newName[Idx]=='\n'))
|
||||
newName[Idx]='-';
|
||||
|
||||
if (host_client->name[0] && strcmp(host_client->name, "unconnected") )
|
||||
if (Q_strcmp(host_client->name, newName) != 0)
|
||||
Con_Printf ("%s renamed to %s\n", host_client->name, newName);
|
||||
Q_strcpy (host_client->name, newName);
|
||||
|
|
Loading…
Reference in a new issue