iw4x-client/src/Components/Modules/Bans.hpp

34 lines
685 B
C++
Raw Normal View History

2017-01-20 08:36:52 -05:00
#pragma once
2017-01-19 16:23:59 -05:00
namespace Components
{
class Bans : public Component
{
public:
2022-06-28 03:26:43 -04:00
using banEntry = std::pair<SteamID, Game::netIP_t>;
2017-01-19 16:23:59 -05:00
Bans();
2022-06-28 03:26:43 -04:00
static void BanClient(Game::client_t* cl, const std::string& reason);
2018-10-13 11:37:37 -04:00
static void UnbanClient(SteamID id);
static void UnbanClient(Game::netIP_t ip);
2017-01-19 16:23:59 -05:00
2022-06-28 03:26:43 -04:00
static bool IsBanned(const banEntry& entry);
static void InsertBan(const banEntry& entry);
2017-01-19 16:23:59 -05:00
private:
2022-06-28 03:26:43 -04:00
struct BanList
2017-01-19 16:23:59 -05:00
{
std::vector<SteamID> idList;
std::vector<Game::netIP_t> ipList;
};
2023-01-25 13:20:44 -05:00
static const char* BanListFile;
static std::unique_lock<Utils::NamedMutex> Lock();
2017-01-19 16:23:59 -05:00
static void LoadBans(BanList* list);
2022-06-28 03:26:43 -04:00
static void SaveBans(const BanList* list);
2017-01-19 16:23:59 -05:00
};
}