mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-04 02:55:50 +03:00
Merge pull request #155 from WPMGPRoSToTeMa/kickfeatures
Added replacing escape sequences in kick reason (#154)
This commit is contained in:
commit
30a97dfaab
@ -6067,6 +6067,42 @@ void SV_BanId_f(void)
|
|||||||
host_client = save;
|
host_client = save;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
void ReplaceEscapeSequences(char *str)
|
||||||
|
{
|
||||||
|
size_t len = 0;
|
||||||
|
for (size_t i = 0; str[i] != '\0'; i++)
|
||||||
|
{
|
||||||
|
if (str[i] == '\\')
|
||||||
|
{
|
||||||
|
switch (str[++i])
|
||||||
|
{
|
||||||
|
case 't':
|
||||||
|
str[len++] = '\t';
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
str[len++] = '\n';
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
str[len++] = '\\';
|
||||||
|
break;
|
||||||
|
// TODO: or ignore it?
|
||||||
|
default:
|
||||||
|
str[len++] = '\\';
|
||||||
|
str[len++] = str[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str[len++] = str[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
str[len] = '\0';
|
||||||
|
}
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
|
|
||||||
/* <ab1ec> ../engine/sv_main.c:8040 */
|
/* <ab1ec> ../engine/sv_main.c:8040 */
|
||||||
void Host_Kick_f(void)
|
void Host_Kick_f(void)
|
||||||
{
|
{
|
||||||
@ -6209,6 +6245,13 @@ void Host_Kick_f(void)
|
|||||||
const char *message = dataLen + p;
|
const char *message = dataLen + p;
|
||||||
if (message)
|
if (message)
|
||||||
{
|
{
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
char reason[256];
|
||||||
|
Q_strncpy(reason, message, sizeof(reason) - 1);
|
||||||
|
reason[sizeof(reason) - 1] = '\0';
|
||||||
|
ReplaceEscapeSequences(reason);
|
||||||
|
message = reason;
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
SV_ClientPrintf("Kicked by %s: %s\n", who, message);
|
SV_ClientPrintf("Kicked by %s: %s\n", who, message);
|
||||||
Log_Printf(
|
Log_Printf(
|
||||||
"Kick: \"%s<%i><%s><>\" was kicked by \"%s\" (message \"%s\")\n",
|
"Kick: \"%s<%i><%s><>\" was kicked by \"%s\" (message \"%s\")\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user