Commit MetaInfo

Révision768c267cf2a999ffbdd4d2f08647c5bd87d31914 (tree)
l'heure2021-10-17 14:15:52
AuteurAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Message de Log

Spectators can no longer send private messages to the server while the chat is restricted.

Change Summary

Modification

diff -r cdc34667be98 -r 768c267cf2a9 src/chat.cpp
--- a/src/chat.cpp Sat Oct 16 01:06:31 2021 -0400
+++ b/src/chat.cpp Sun Oct 17 01:15:52 2021 -0400
@@ -787,8 +787,10 @@
787787 {
788788 if ( g_ulChatMode != CHATMODE_PRIVATE_SEND )
789789 note += "Players cannot hear you chat";
790- else if (( g_ulChatPlayer != MAXPLAYERS ) && ( players[g_ulChatPlayer].bSpectating == false ))
791- note.AppendFormat( "%s " TEXTCOLOR_GRAY "cannot hear you chat", players[g_ulChatPlayer].userinfo.GetName());
790+ else if ( g_ulChatPlayer == MAXPLAYERS )
791+ note += "The server cannot hear you chat";
792+ else if ( players[g_ulChatPlayer].bSpectating == false )
793+ note.AppendFormat( "%s " TEXTCOLOR_GRAY "cannot hear you chat", players[g_ulChatPlayer].userinfo.GetName() );
792794 else bDrawNote = false;
793795 }
794796 else
diff -r cdc34667be98 -r 768c267cf2a9 src/sv_commands.cpp
--- a/src/sv_commands.cpp Sat Oct 16 01:06:31 2021 -0400
+++ b/src/sv_commands.cpp Sun Oct 17 01:15:52 2021 -0400
@@ -1077,8 +1077,19 @@
10771077 //
10781078 void SERVERCOMMANDS_PrivateSay( ULONG ulSender, ULONG ulReceiver, const char *pszString, bool bForbidChatToPlayers, ULONG ulPlayerExtra, ServerCommandFlags flags )
10791079 {
1080- if ( ulSender != MAXPLAYERS && PLAYER_IsValidPlayer( ulSender ) == false )
1081- return;
1080+ if ( ulSender != MAXPLAYERS )
1081+ {
1082+ if ( PLAYER_IsValidPlayer( ulSender ) == false )
1083+ return;
1084+
1085+ // [AK] Spectators cannot send private messages to the server or non-spectators when the chat is restricted.
1086+ if (( bForbidChatToPlayers ) && (( ulReceiver == MAXPLAYERS ) || ( players[ulReceiver].bSpectating == false )))
1087+ {
1088+ SERVER_PrintfPlayer( ulSender, "You can't send any private messages to %s right now.\n",
1089+ ( ulReceiver == MAXPLAYERS ) ? "the server" : players[ulReceiver].userinfo.GetName() );
1090+ return;
1091+ }
1092+ }
10821093
10831094 ServerCommands::PlayerSay command;
10841095 command.SetMessage( pszString );
@@ -1086,13 +1097,6 @@
10861097 // [AK] First send the command to the player receiving the message.
10871098 if ( ulReceiver != MAXPLAYERS )
10881099 {
1089- if (( bForbidChatToPlayers ) && ( players[ulReceiver].bSpectating == false ))
1090- {
1091- SERVER_PrintfPlayer( ulSender, "You can't send any private messages to %s right now.\n",
1092- players[ulReceiver].userinfo.GetName() );
1093- return;
1094- }
1095-
10961100 // [AK] Don't send the command if the sender is supposed to be ignoring the player who receives the message.
10971101 if (( ulSender != MAXPLAYERS ) && ( SERVER_GetPlayerIgnoreTic( ulSender, SERVER_GetClient( ulReceiver )->Address ) != 0 ))
10981102 {
diff -r cdc34667be98 -r 768c267cf2a9 src/sv_main.cpp
--- a/src/sv_main.cpp Sat Oct 16 01:06:31 2021 -0400
+++ b/src/sv_main.cpp Sun Oct 17 01:15:52 2021 -0400
@@ -1191,9 +1191,16 @@
11911191 GAMEMODE_HandleEvent( GAMEEVENT_CHAT, 0, ulPlayer != MAXPLAYERS ? ulPlayer : -1, ulMode - CHATMODE_GLOBAL );
11921192 }
11931193
1194- // [AK] Don't log private messages that aren't sent to/from the server.
1195- if (( ulMode == CHATMODE_PRIVATE_SEND ) && ( ulPlayer != MAXPLAYERS ) && ( ulReceiver != MAXPLAYERS ))
1196- return;
1194+ if ( ulMode == CHATMODE_PRIVATE_SEND )
1195+ {
1196+ // [AK] Don't log private messages that aren't sent to/from the server.
1197+ if (( ulPlayer != MAXPLAYERS ) && ( ulReceiver != MAXPLAYERS ))
1198+ return;
1199+
1200+ // [AK] Don't log private messages sent by spectators when the chat is restricted.
1201+ if (( ulReceiver == MAXPLAYERS ) && ( bForbidChatToPlayers ))
1202+ return;
1203+ }
11971204
11981205 // [BB] This is to make the lines readily identifiable, necessary
11991206 // for MiX-MaN's IRC server control tool for example.
Afficher sur ancien navigateur de dépôt.