2018-07-06 14:11:38 +00:00
|
|
|
#ifndef ENGINE_SERVER_NAME_BAN_H
|
|
|
|
#define ENGINE_SERVER_NAME_BAN_H
|
2018-03-14 01:35:31 +00:00
|
|
|
|
|
|
|
#include <base/system.h>
|
|
|
|
#include <engine/shared/protocol.h>
|
|
|
|
|
2022-03-30 13:16:19 +00:00
|
|
|
#include <array> // std::size
|
|
|
|
|
2018-03-14 01:35:31 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
MAX_NAME_SKELETON_LENGTH = MAX_NAME_LENGTH * 4,
|
|
|
|
MAX_NAMEBAN_REASON_LENGTH = 64
|
2018-03-14 01:35:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CNameBan
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CNameBan() {}
|
2019-03-11 13:48:45 +00:00
|
|
|
CNameBan(const char *pName, int Distance, int IsSubstring, const char *pReason = "") :
|
|
|
|
m_Distance(Distance), m_IsSubstring(IsSubstring)
|
2018-03-14 01:35:31 +00:00
|
|
|
{
|
|
|
|
str_copy(m_aName, pName, sizeof(m_aName));
|
2022-03-30 13:16:19 +00:00
|
|
|
m_SkeletonLength = str_utf8_to_skeleton(m_aName, m_aSkeleton, std::size(m_aSkeleton));
|
2018-03-14 01:35:31 +00:00
|
|
|
str_copy(m_aReason, pReason, sizeof(m_aReason));
|
|
|
|
}
|
|
|
|
char m_aName[MAX_NAME_LENGTH];
|
|
|
|
char m_aReason[MAX_NAMEBAN_REASON_LENGTH];
|
|
|
|
int m_aSkeleton[MAX_NAME_SKELETON_LENGTH];
|
|
|
|
int m_SkeletonLength;
|
|
|
|
int m_Distance;
|
2019-03-11 13:48:45 +00:00
|
|
|
int m_IsSubstring;
|
2018-03-14 01:35:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
CNameBan *IsNameBanned(const char *pName, CNameBan *pNameBans, int NumNameBans);
|
|
|
|
|
2018-07-06 14:11:38 +00:00
|
|
|
#endif // ENGINE_SERVER_NAME_BAN_H
|