Merge pull request #7501 from heinrich5991/pr_ddnet_antibot_kick

Allow antibot to kick people
This commit is contained in:
Robert Müller 2023-11-19 15:04:57 +00:00 committed by GitHub
commit 9a652ecaae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View file

@ -6,7 +6,7 @@
enum
{
ANTIBOT_ABI_VERSION = 8,
ANTIBOT_ABI_VERSION = 9,
ANTIBOT_MSGFLAG_NONVITAL = 1,
ANTIBOT_MSGFLAG_FLUSH = 2,
@ -88,6 +88,7 @@ struct CAntibotData
int64_t m_Now;
int64_t m_Freq;
void (*m_pfnKick)(int ClientID, const char *pMessage, void *pUser);
void (*m_pfnLog)(const char *pMessage, void *pUser);
void (*m_pfnReport)(int ClientID, const char *pMessage, void *pUser);
void (*m_pfnSend)(int ClientID, const void *pData, int DataSize, int Flags, void *pUser);

View file

@ -23,6 +23,11 @@ CAntibot::~CAntibot()
if(m_Initialized)
AntibotDestroy();
}
void CAntibot::Kick(int ClientID, const char *pMessage, void *pUser)
{
CAntibot *pAntibot = (CAntibot *)pUser;
pAntibot->Server()->Kick(ClientID, pMessage);
}
void CAntibot::Log(const char *pMessage, void *pUser)
{
CAntibot *pAntibot = (CAntibot *)pUser;
@ -67,6 +72,7 @@ void CAntibot::Init()
m_Data.m_Now = time_get();
m_Data.m_Freq = time_freq();
m_Data.m_pfnKick = Kick;
m_Data.m_pfnLog = Log;
m_Data.m_pfnReport = Report;
m_Data.m_pfnSend = Send;

View file

@ -19,6 +19,7 @@ class CAntibot : public IEngineAntibot
bool m_Initialized;
void Update();
static void Kick(int ClientID, const char *pMessage, void *pUser);
static void Log(const char *pMessage, void *pUser);
static void Report(int ClientID, const char *pMessage, void *pUser);
static void Send(int ClientID, const void *pData, int Size, int Flags, void *pUser);