From ef8e59610a3c2b3c9262fd49b4b636ad9d5a9865 Mon Sep 17 00:00:00 2001 From: Joseph Carter Date: Fri, 7 Jan 2000 05:02:38 +0000 Subject: [PATCH] filter patch to remove \r and \n from people's names in the server --- uquake/host.c | 4 ++++ uquake/host_cmd.c | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/uquake/host.c b/uquake/host.c index 7ceccd1..2a3506d 100644 --- a/uquake/host.c +++ b/uquake/host.c @@ -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 (); diff --git a/uquake/host_cmd.c b/uquake/host_cmd.c index dff5a75..ea7b0da 100644 --- a/uquake/host_cmd.c +++ b/uquake/host_cmd.c @@ -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;Idxname[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);