mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-22 02:00:11 +00:00
PT_SAY: Restore cv_mute and stop_spamming
This commit is contained in:
parent
42251419e0
commit
346a778365
3 changed files with 47 additions and 15 deletions
|
|
@ -222,6 +222,8 @@ consvar_t cv_httpsource = CVAR_INIT ("http_source", "", CV_SAVE, NULL, NULL);
|
|||
|
||||
consvar_t cv_kicktime = CVAR_INIT ("kicktime", "10", CV_SAVE, CV_Unsigned, NULL);
|
||||
|
||||
static tic_t stop_spamming[MAXPLAYERS];
|
||||
|
||||
// Generate a message for an authenticating client to sign, with some guarantees about who we are.
|
||||
void GenerateChallenge(uint8_t *buf)
|
||||
{
|
||||
|
|
@ -5250,6 +5252,36 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||
if (playernode[say.source] != node)
|
||||
break; // Spoofed source!
|
||||
|
||||
if ((cv_mute.value || say.flags & (HU_CSAY|HU_SHOUT)) && say.source != serverplayer && !(IsPlayerAdmin(say.source)))
|
||||
{
|
||||
CONS_Debug(DBG_NETPLAY,"Received SAY cmd from Player %d (%s), but cv_mute is on.\n", say.source+1, player_names[say.source]);
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
size_t i;
|
||||
const size_t j = strlen(say.message);
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
if (say.message[i] & 0x80)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal say command received from %s containing invalid characters\n"), player_names[say.source]);
|
||||
if (server)
|
||||
SendKick(say.source, KICK_MSG_CON_FAIL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stop_spamming[say.source] != 0 && consoleplayer != say.source && cv_chatspamprotection.value && !(say.flags & (HU_CSAY|HU_SHOUT)))
|
||||
{
|
||||
CONS_Debug(DBG_NETPLAY,"Received SAY cmd too quickly from Player %d (%s), assuming as spam and blocking message.\n", say.source+1, player_names[say.source]);
|
||||
stop_spamming[say.source] = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
stop_spamming[say.source] = 4;
|
||||
|
||||
DoSayCommand(say.message, say.target, say.flags, say.source);
|
||||
break;
|
||||
case PT_LOGIN:
|
||||
|
|
@ -6806,6 +6838,15 @@ void NetUpdate(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (server)
|
||||
{
|
||||
for(; (i<MAXPLAYERS); i++)
|
||||
{
|
||||
if (stop_spamming[i] > 0)
|
||||
stop_spamming[i]--;
|
||||
}
|
||||
}
|
||||
|
||||
Net_AckTicker();
|
||||
HandleNodeTimeouts();
|
||||
|
||||
|
|
|
|||
|
|
@ -66,12 +66,6 @@
|
|||
#define HU_INPUTX 0
|
||||
#define HU_INPUTY 0
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HU_SHOUT = 1, // Shout message
|
||||
HU_CSAY = 1<<1, // Middle-of-screen server message
|
||||
} sayflags_t;
|
||||
|
||||
//-------------------------------------------
|
||||
// heads up font
|
||||
//-------------------------------------------
|
||||
|
|
@ -622,8 +616,6 @@ static void Command_Shout(void)
|
|||
DoSayPacketFromCommand(0, 1, HU_SHOUT);
|
||||
}
|
||||
|
||||
static tic_t stop_spamming[MAXPLAYERS];
|
||||
|
||||
/** Receives a message, processing an ::XD_SAY command.
|
||||
* \sa DoSayPacket
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
|
|
@ -930,13 +922,6 @@ void HU_Ticker(void)
|
|||
{
|
||||
size_t i = 0;
|
||||
|
||||
// handle spam while we're at it:
|
||||
for(; (i<MAXPLAYERS); i++)
|
||||
{
|
||||
if (stop_spamming[i] > 0)
|
||||
stop_spamming[i]--;
|
||||
}
|
||||
|
||||
// handle chat timers
|
||||
for (i=0; (i<chat_nummsg_min); i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -105,6 +105,12 @@ struct playersort_t
|
|||
#define CHAT_MUTE (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this still allows to open the chat but not to type. That's used for scrolling and whatnot.
|
||||
#define OLD_MUTE (OLDCHAT && cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this is used to prevent oldchat from opening when muted.
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HU_SHOUT = 1, // Shout message
|
||||
HU_CSAY = 1<<1, // Middle-of-screen server message
|
||||
} sayflags_t;
|
||||
|
||||
// some functions
|
||||
void HU_AddChatText(const char *text, boolean playsound);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue