summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mvd_game.c6
-rw-r--r--src/mvd_local.h2
-rw-r--r--src/mvd_public.h2
-rw-r--r--src/sv_ccmds.c2
-rw-r--r--src/sv_main.c43
-rw-r--r--src/sv_user.c12
6 files changed, 35 insertions, 32 deletions
diff --git a/src/mvd_game.c b/src/mvd_game.c
index acf0654..0c15c2a 100644
--- a/src/mvd_game.c
+++ b/src/mvd_game.c
@@ -1627,14 +1627,14 @@ void MVD_GameClientNameChanged( edict_t *ent, const char *name ) {
}
}
-// called early from SV_Drop to prevent multiple disconnect messages
-void MVD_GameClientDrop( edict_t *ent, const char *reason ) {
+// called early from SV_DropClient to prevent multiple disconnect messages
+void MVD_GameClientDrop( edict_t *ent, const char *prefix, const char *reason ) {
mvd_client_t *client = EDICT_MVDCL( ent );
client_t *cl = client->cl;
if( client->begin_time && MVD_PartFilter( client ) ) {
MVD_BroadcastPrintf( client->mvd, PRINT_MEDIUM, UF_MUTE_MISC,
- "[MVD] %s was dropped: %s\n", cl->name, reason );
+ "[MVD] %s%s%s\n", cl->name, prefix, reason );
}
client->begin_time = 0;
diff --git a/src/mvd_local.h b/src/mvd_local.h
index 6ebbc4a..b516b11 100644
--- a/src/mvd_local.h
+++ b/src/mvd_local.h
@@ -223,7 +223,7 @@ void MVD_BroadcastPrintf( mvd_t *mvd, int level,
int mask, const char *fmt, ... ) q_printf( 4, 5 );
void MVD_PrepWorldFrame( void );
void MVD_GameClientNameChanged( edict_t *ent, const char *name );
-void MVD_GameClientDrop( edict_t *ent, const char *reason );
+void MVD_GameClientDrop( edict_t *ent, const char *prefix, const char *reason );
void MVD_UpdateClients( mvd_t *mvd );
void MVD_FreePlayer( mvd_player_t *player );
void MVD_UpdateConfigstring( mvd_t *mvd, int index );
diff --git a/src/mvd_public.h b/src/mvd_public.h
index 940304b..7883504 100644
--- a/src/mvd_public.h
+++ b/src/mvd_public.h
@@ -30,7 +30,7 @@ void MVD_RemoveClient( struct client_s *client );
int MVD_Frame( void );
void MVD_PrepWorldFrame( void );
-void MVD_GameClientDrop( edict_t *ent, const char *reason );
+void MVD_GameClientDrop( edict_t *ent, const char *prefix, const char *reason );
void MVD_GameClientNameChanged( edict_t *ent, const char *name );
void MVD_StreamedStop_f( void );
diff --git a/src/sv_ccmds.c b/src/sv_ccmds.c
index 6cf835e..a018052 100644
--- a/src/sv_ccmds.c
+++ b/src/sv_ccmds.c
@@ -462,7 +462,7 @@ static void SV_Kick_f( void ) {
if( !SV_SetPlayer() )
return;
- SV_DropClient( sv_client, "kicked" );
+ SV_DropClient( sv_client, "?was kicked" );
sv_client->lastmessage = svs.realtime; // min case there is a funny zombie
// optionally ban their IP address
diff --git a/src/sv_main.c b/src/sv_main.c
index ab0a43d..671acf6 100644
--- a/src/sv_main.c
+++ b/src/sv_main.c
@@ -176,28 +176,39 @@ void SV_DropClient( client_t *client, const char *reason ) {
client->lastmessage = svs.realtime;
if( reason ) {
- if( oldstate == cs_spawned ) {
+ qboolean announce = oldstate == cs_spawned ? 2 : 1;
+ const char *prefix = " was dropped: ";
+
+ // parse flags
+ if( *reason == '!' ) {
+ reason++;
+ announce = 0;
+ }
+ if( *reason == '?' ) {
+ reason++;
+ prefix = " ";
+ }
+
+ if( announce == 2 ) {
// announce to others
#if USE_MVD_CLIENT
- if( sv.state == ss_broadcast ) {
- MVD_GameClientDrop( client->edict, reason );
- } else
+ if( sv.state == ss_broadcast )
+ MVD_GameClientDrop( client->edict, prefix, reason );
+ else
#endif
- {
- SV_BroadcastPrintf( PRINT_HIGH, "%s was dropped: %s\n",
- client->name, reason );
- }
+ SV_BroadcastPrintf( PRINT_HIGH, "%s%s%s\n",
+ client->name, prefix, reason );
}
- // print this to client as they will not receive broadcast
- SV_ClientPrintf( client, PRINT_HIGH, "%s was dropped: %s\n",
- client->name, reason );
+ if( announce )
+ // print this to client as they will not receive broadcast
+ SV_ClientPrintf( client, PRINT_HIGH, "%s%s%s\n",
+ client->name, prefix, reason );
// print to server console
- if( Com_IsDedicated() ) {
- Com_Printf( "%s[%s] was dropped: %s\n", client->name,
- NET_AdrToString( &client->netchan->remote_address ), reason );
- }
+ if( Com_IsDedicated() && client->netchan )
+ Com_Printf( "%s[%s]%s%s\n", client->name,
+ NET_AdrToString( &client->netchan->remote_address ), prefix, reason );
}
// add the disconnect
@@ -1414,7 +1425,7 @@ static void SV_CheckTimeouts( void ) {
}
#endif
if( delta > drop_time || ( client->state == cs_assigned && delta > ghost_time ) ) {
- SV_DropClient( client, "connection timed out" );
+ SV_DropClient( client, "?timed out" );
SV_RemoveClient( client ); // don't bother with zombie state
continue;
}
diff --git a/src/sv_user.c b/src/sv_user.c
index 941bc62..d143e96 100644
--- a/src/sv_user.c
+++ b/src/sv_user.c
@@ -484,11 +484,7 @@ void SV_Begin_f( void ) {
}
if( sv_force_reconnect->string[0] && !sv_client->reconnected ) {
- if( Com_IsDedicated() ) {
- Com_Printf( "%s[%s]: failed to reconnect\n", sv_client->name,
- NET_AdrToString( &sv_client->netchan->remote_address ) );
- }
- SV_DropClient( sv_client, NULL );
+ SV_DropClient( sv_client, "!failed to reconnect" );
return;
}
@@ -762,11 +758,7 @@ static void SV_StopDownload_f( void ) {
// the client is going to disconnect, so remove the connection immediately
static void SV_Disconnect_f( void ) {
- if( Com_IsDedicated() && sv_client->netchan ) {
- Com_Printf( "%s[%s] disconnected\n", sv_client->name,
- NET_AdrToString( &sv_client->netchan->remote_address ) );
- }
- SV_DropClient( sv_client, NULL );
+ SV_DropClient( sv_client, "!?disconnected" );
SV_RemoveClient( sv_client ); // don't bother with zombie state
}