mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-18 07:22:03 +00:00
Merge branch 'banip-command' into 'next'
Ban IP command See merge request KartKrew/Kart-Public!73
This commit is contained in:
commit
0320b17f80
2 changed files with 40 additions and 3 deletions
|
@ -2725,7 +2725,10 @@ static void Command_Ban(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (server) // only the server is allowed to do this right now
|
if (server) // only the server is allowed to do this right now
|
||||||
|
{
|
||||||
Ban_Add(COM_Argv(2));
|
Ban_Add(COM_Argv(2));
|
||||||
|
D_SaveBan(); // save the ban list
|
||||||
|
}
|
||||||
|
|
||||||
if (COM_Argc() == 2)
|
if (COM_Argc() == 2)
|
||||||
{
|
{
|
||||||
|
@ -2756,6 +2759,42 @@ static void Command_Ban(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Command_BanIP(void)
|
||||||
|
{
|
||||||
|
if (COM_Argc() < 2)
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("banip <ip> <reason>: ban an ip address\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (server) // Only the server can use this, otherwise does nothing.
|
||||||
|
{
|
||||||
|
const char *address = (COM_Argv(1));
|
||||||
|
const char *reason;
|
||||||
|
|
||||||
|
if (COM_Argc() == 2)
|
||||||
|
reason = NULL;
|
||||||
|
else
|
||||||
|
reason = COM_Argv(2);
|
||||||
|
|
||||||
|
|
||||||
|
if (I_SetBanAddress && I_SetBanAddress(address, NULL))
|
||||||
|
{
|
||||||
|
if (reason)
|
||||||
|
CONS_Printf("Banned IP address %s for: %s\n", address, reason);
|
||||||
|
else
|
||||||
|
CONS_Printf("Banned IP address %s\n", address);
|
||||||
|
|
||||||
|
Ban_Add(reason);
|
||||||
|
D_SaveBan();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void Command_Kick(void)
|
static void Command_Kick(void)
|
||||||
{
|
{
|
||||||
if (COM_Argc() < 2)
|
if (COM_Argc() < 2)
|
||||||
|
@ -3062,6 +3101,7 @@ void D_ClientServerInit(void)
|
||||||
COM_AddCommand("getplayernum", Command_GetPlayerNum);
|
COM_AddCommand("getplayernum", Command_GetPlayerNum);
|
||||||
COM_AddCommand("kick", Command_Kick);
|
COM_AddCommand("kick", Command_Kick);
|
||||||
COM_AddCommand("ban", Command_Ban);
|
COM_AddCommand("ban", Command_Ban);
|
||||||
|
COM_AddCommand("banip", Command_BanIP);
|
||||||
COM_AddCommand("clearbans", Command_ClearBans);
|
COM_AddCommand("clearbans", Command_ClearBans);
|
||||||
COM_AddCommand("showbanlist", Command_ShowBan);
|
COM_AddCommand("showbanlist", Command_ShowBan);
|
||||||
COM_AddCommand("reloadbans", Command_ReloadBan);
|
COM_AddCommand("reloadbans", Command_ReloadBan);
|
||||||
|
|
|
@ -639,9 +639,6 @@ void I_Error(const char *error, ...)
|
||||||
if (!errorcount)
|
if (!errorcount)
|
||||||
{
|
{
|
||||||
M_SaveConfig(NULL); // save game config, cvars..
|
M_SaveConfig(NULL); // save game config, cvars..
|
||||||
#ifndef NONET
|
|
||||||
D_SaveBan(); // save the ban list
|
|
||||||
#endif
|
|
||||||
G_SaveGameData();
|
G_SaveGameData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue