summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/g_admin.c17
-rw-r--r--src/game/g_namelog.c8
2 files changed, 18 insertions, 7 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 634d2054..306b1646 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -362,14 +362,16 @@ qboolean G_admin_name_check( gentity_t *ent, char *name, char *err, int len )
if( !strcmp( name2, "console" ) )
{
- Q_strncpyz( err, "The name 'console' is not allowed.", len );
+ if( err && len > 0 )
+ Q_strncpyz( err, "The name 'console' is not allowed.", len );
return qfalse;
}
G_DecolorString( name, testName, sizeof( testName ) );
if( isdigit( testName[ 0 ] ) )
{
- Q_strncpyz( err, "Names cannot begin with numbers", len );
+ if( err && len > 0 )
+ Q_strncpyz( err, "Names cannot begin with numbers", len );
return qfalse;
}
@@ -381,7 +383,8 @@ qboolean G_admin_name_check( gentity_t *ent, char *name, char *err, int len )
if( alphaCount == 0 )
{
- Q_strncpyz( err, "Names must contain letters", len );
+ if( err && len > 0 )
+ Q_strncpyz( err, "Names must contain letters", len );
return qfalse;
}
@@ -398,7 +401,8 @@ qboolean G_admin_name_check( gentity_t *ent, char *name, char *err, int len )
G_SanitiseString( client->pers.netname, testName, sizeof( testName ) );
if( !strcmp( name2, testName ) )
{
- Com_sprintf( err, len, "The name '%s^7' is already in use", name );
+ if( err && len > 0 )
+ Com_sprintf( err, len, "The name '%s^7' is already in use", name );
return qfalse;
}
}
@@ -410,8 +414,9 @@ qboolean G_admin_name_check( gentity_t *ent, char *name, char *err, int len )
G_SanitiseString( admin->name, testName, sizeof( testName ) );
if( !strcmp( name2, testName ) && ent->client->pers.admin != admin )
{
- Com_sprintf( err, len, "The name '%s^7' belongs to an admin, "
- "please use another name", name );
+ if( err && len > 0 )
+ Com_sprintf( err, len, "The name '%s^7' belongs to an admin, "
+ "please use another name", name );
return qfalse;
}
}
diff --git a/src/game/g_namelog.c b/src/game/g_namelog.c
index 60642496..9d9f3b83 100644
--- a/src/game/g_namelog.c
+++ b/src/game/g_namelog.c
@@ -37,6 +37,7 @@ void G_namelog_connect( gclient_t *client )
{
namelog_t *n, *p = NULL;
int i;
+ char *newname;
for( n = level.namelogs; n; p = n, n = n->next )
{
@@ -58,7 +59,12 @@ void G_namelog_connect( gclient_t *client )
n->slot = client - level.clients;
n->banned = qfalse;
- G_namelog_update_name( client );
+ newname = n->name[ n->nameChanges % MAX_NAMELOG_NAMES ];
+ // If they're muted, copy in their last known name - this will stop people
+ // reconnecting to get around the name change protection.
+ if( n->muted && G_admin_name_check( &g_entities[ n->slot ],
+ newname, NULL, 0 ) )
+ Q_strncpyz( client->pers.netname, newname, MAX_NAME_LENGTH );
for( i = 0; i < MAX_NAMELOG_ADDRS && n->ip[ i ].str[ 0 ]; i++ )
if( !strcmp( n->ip[ i ].str, client->pers.ip.str ) )