r5sdk/r5dev/networksystem/bansystem.h
Kawe Mazidjatari 48bc69b028 Initial implementation of bulk ban checking
Initial implementation of the bulk ban check system. This implementation takes a snapshot of the currently connected clients, sends it up to the master server, and the master server returns anything within this list that is marked 'banned'. The server would then kick the player from the server. This commit also removes the global banned list cache, as the bulk checking system offers a lot more freedom regarding banning specific players and have it sync across all available servers.
2023-04-28 23:47:58 +02:00

33 lines
1021 B
C++

#pragma once
typedef vector<std::pair<string, uint64_t>> BannedVec_t;
class CBanSystem
{
public:
void Load(void);
void Save(void) const;
bool AddEntry(const string& svIpAddress, const uint64_t nNucleusID);
bool DeleteEntry(const string& svIpAddress, const uint64_t nNucleusID);
bool IsBanned(const string& svIpAddress, const uint64_t nNucleusID) const;
bool IsBanListValid(void) const;
void KickPlayerByName(const char* playerName, const char* reason = nullptr);
void KickPlayerById(const char* playerHandle, const char* reason = nullptr);
void BanPlayerByName(const char* playerName, const char* reason = nullptr);
void BanPlayerById(const char* playerHandle, const char* reason = nullptr);
void UnbanPlayer(const string& svCriteria);
private:
void AuthorPlayerByName(const char* playerName, const bool bBan, const char* reason = nullptr);
void AuthorPlayerById(const char* playerHandle, const bool bBan, const char* reason = nullptr);
BannedVec_t m_vBanList;
};
extern CBanSystem* g_pBanSystem;