Skip to content

Commit d302d3c

Browse files
committed
Remove outdated community account handling
This also includes missing changes for 859e6ce
1 parent fe761e5 commit d302d3c

File tree

5 files changed

+18
-123
lines changed

5 files changed

+18
-123
lines changed

Server/mods/deathmatch/logic/CBan.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@ class CBan
7070
m_strSerial = strSerial;
7171
};
7272

73-
const std::string& GetAccount() { return m_strAccount; };
74-
void SetAccount(const std::string& strAccount)
75-
{
76-
CBanManager::SetBansModified();
77-
m_strAccount = strAccount;
78-
};
79-
8073
time_t GetBanTimeRemaining();
8174
SString GetDurationDesc();
8275
SString GetReasonText() const;
@@ -90,7 +83,6 @@ class CBan
9083
std::string m_strBanner;
9184
std::string m_strReason;
9285
std::string m_strSerial;
93-
std::string m_strAccount;
9486
time_t m_tTimeOfBan;
9587
time_t m_tTimeOfUnban;
9688
uint m_uiScriptID;

Server/mods/deathmatch/logic/CBanManager.cpp

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -141,34 +141,6 @@ CBan* CBanManager::AddSerialBan(const SString& strSerial, CClient* pBanner, cons
141141
return NULL;
142142
}
143143

144-
CBan* CBanManager::AddAccountBan(CPlayer* pPlayer, CClient* pBanner, const SString& strReason, time_t tTimeOfUnban)
145-
{
146-
if (pPlayer)
147-
{
148-
if (!pPlayer->GetSerialUser().empty() && !IsAccountBanned(pPlayer->GetSerialUser().c_str()))
149-
{
150-
CBan* pBan = AddBan(pBanner->GetNick(), strReason, tTimeOfUnban);
151-
pBan->SetNick(pPlayer->GetNick());
152-
pBan->SetAccount(pPlayer->GetSerialUser());
153-
return pBan;
154-
}
155-
}
156-
157-
return NULL;
158-
}
159-
160-
CBan* CBanManager::AddAccountBan(const SString& strAccount, CClient* pBanner, const SString& strReason, time_t tTimeOfUnban)
161-
{
162-
if (!IsAccountBanned(strAccount.c_str()))
163-
{
164-
CBan* pBan = AddBan(pBanner->GetNick(), strReason, tTimeOfUnban);
165-
pBan->SetSerial(strAccount);
166-
return pBan;
167-
}
168-
169-
return NULL;
170-
}
171-
172144
CBan* CBanManager::AddBan(const SString& strBanner, const SString& strReason, time_t tTimeOfUnban)
173145
{
174146
// Create the ban and assign its values
@@ -223,34 +195,6 @@ bool CBanManager::IsSerialBanned(const char* szSerial)
223195
return false;
224196
}
225197

226-
bool CBanManager::IsAccountBanned(const char* szAccount)
227-
{
228-
list<CBan*>::const_iterator iter = m_BanManager.begin();
229-
for (; iter != m_BanManager.end(); iter++)
230-
{
231-
if ((*iter)->GetAccount() == szAccount)
232-
{
233-
return true;
234-
}
235-
}
236-
237-
return false;
238-
}
239-
240-
CBan* CBanManager::GetBanFromAccount(const char* szAccount)
241-
{
242-
list<CBan*>::const_iterator iter = m_BanManager.begin();
243-
for (; iter != m_BanManager.end(); iter++)
244-
{
245-
if ((*iter)->GetAccount() == szAccount)
246-
{
247-
return (*iter);
248-
}
249-
}
250-
251-
return NULL;
252-
}
253-
254198
void CBanManager::RemoveBan(CBan* pBan)
255199
{
256200
if (m_BanManager.Contains(pBan))
@@ -388,15 +332,14 @@ bool CBanManager::LoadBanList()
388332
{
389333
if (pNode->GetTagName().compare("ban") == 0)
390334
{
391-
std::string strIP = SafeGetValue(pNode, "ip"), strSerial = SafeGetValue(pNode, "serial"), strAccount = SafeGetValue(pNode, "account");
392-
if (!strIP.empty() || !strSerial.empty() || !strAccount.empty())
335+
std::string strIP = SafeGetValue(pNode, "ip"), strSerial = SafeGetValue(pNode, "serial");
336+
if (!strIP.empty() || !strSerial.empty())
393337
{
394338
CBan* pBan = AddBan();
395339
if (IsValidIP(strIP.c_str()))
396340
{
397341
pBan->SetIP(strIP);
398342
}
399-
pBan->SetAccount(strAccount);
400343
pBan->SetSerial(strSerial);
401344
pBan->SetBanner(SafeGetValue(pNode, "banner"));
402345
pBan->SetNick(SafeGetValue(pNode, "nick"));
@@ -466,7 +409,6 @@ void CBanManager::SaveBanList()
466409
SafeSetValue(pNode, "nick", (*iter)->GetNick());
467410
SafeSetValue(pNode, "ip", (*iter)->GetIP());
468411
SafeSetValue(pNode, "serial", (*iter)->GetSerial());
469-
SafeSetValue(pNode, "account", (*iter)->GetAccount());
470412
SafeSetValue(pNode, "banner", (*iter)->GetBanner());
471413
SafeSetValue(pNode, "reason", (*iter)->GetReason());
472414
SafeSetValue(pNode, "time", (unsigned int)(*iter)->GetTimeOfBan());

Server/mods/deathmatch/logic/CBanManager.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,13 @@ class CBanManager
2828
CBan* AddSerialBan(CPlayer* pPlayer, CClient* pBanner = NULL, const SString& strReason = "", time_t tTimeOfUnban = 0);
2929
CBan* AddSerialBan(const SString& strSerial, CClient* pBanner = NULL, const SString& strReason = "", time_t tTimeOfUnban = 0);
3030

31-
CBan* AddAccountBan(CPlayer* pPlayer, CClient* pBanner = NULL, const SString& strReason = "", time_t tTimeOfUnban = 0);
32-
CBan* AddAccountBan(const SString& szAccount, CClient* pBanner = NULL, const SString& strReason = "", time_t tTimeOfUnban = 0);
33-
3431
CBan* AddBan(const SString& strBanner = "Console", const SString& strReason = "", time_t tTimeOfUnban = 0);
3532

3633
CBan* GetBanFromScriptID(uint uiScriptID);
3734

38-
bool IsSpecificallyBanned(const char* szIP);
39-
bool IsSerialBanned(const char* szSerial);
40-
bool IsAccountBanned(const char* szAccount);
41-
CBan* GetBanFromAccount(const char* szAccount);
42-
void RemoveBan(CBan* pBan);
35+
bool IsSpecificallyBanned(const char* szIP);
36+
bool IsSerialBanned(const char* szSerial);
37+
void RemoveBan(CBan* pBan);
4338

4439
CBan* GetBanFromSerial(const char* szSerial);
4540
CBan* GetBanFromIP(const char* szIP);

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3092,18 +3092,14 @@ const std::string& CStaticFunctionDefinitions::GetPlayerSerial(CPlayer* pPlayer,
30923092
return pPlayer->GetSerial(uiIndex);
30933093
}
30943094

3095-
const std::string& CStaticFunctionDefinitions::GetPlayerUserName(CPlayer* pPlayer)
3095+
std::string CStaticFunctionDefinitions::GetPlayerUserName(CPlayer* pPlayer)
30963096
{
3097-
assert(pPlayer);
3098-
3099-
return pPlayer->GetSerialUser();
3097+
return "";
31003098
}
31013099

3102-
const std::string& CStaticFunctionDefinitions::GetPlayerCommunityID(CPlayer* pPlayer)
3100+
std::string CStaticFunctionDefinitions::GetPlayerCommunityID(CPlayer* pPlayer)
31033101
{
3104-
assert(pPlayer);
3105-
3106-
return pPlayer->GetCommunityID();
3102+
return "";
31073103
}
31083104

31093105
bool CStaticFunctionDefinitions::GetPlayerBlurLevel(CPlayer* pPlayer, unsigned char& ucLevel)
@@ -5498,7 +5494,7 @@ bool CStaticFunctionDefinitions::BlowVehicle(CElement* pElement, std::optional<b
54985494

54995495
CBitStream BitStream;
55005496
BitStream.pBitStream->Write(vehicle->GenerateSyncTimeContext());
5501-
BitStream.pBitStream->WriteBit(createExplosion); // only consumed by clients with at least eBitStreamVersion::VehicleBlowStateSupport
5497+
BitStream.pBitStream->WriteBit(createExplosion);
55025498
m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(vehicle, BLOW_VEHICLE, *BitStream.pBitStream));
55035499
return true;
55045500
}
@@ -10941,12 +10937,8 @@ bool CStaticFunctionDefinitions::SendSyncIntervals(CPlayer* pPlayer)
1094110937
BitStream.pBitStream->Write(g_TickRateSettings.iObjectSync);
1094210938
BitStream.pBitStream->Write(g_TickRateSettings.iKeySyncRotation);
1094310939
BitStream.pBitStream->Write(g_TickRateSettings.iKeySyncAnalogMove);
10944-
10945-
if (pPlayer->CanBitStream(eBitStreamVersion::FixSyncerDistance))
10946-
{
10947-
BitStream.pBitStream->Write(g_TickRateSettings.iPedSyncerDistance);
10948-
BitStream.pBitStream->Write(g_TickRateSettings.iUnoccupiedVehicleSyncerDistance);
10949-
}
10940+
BitStream.pBitStream->Write(g_TickRateSettings.iPedSyncerDistance);
10941+
BitStream.pBitStream->Write(g_TickRateSettings.iUnoccupiedVehicleSyncerDistance);
1095010942

1095110943
pPlayer->Send(CLuaPacket(SET_SYNC_INTERVALS, *BitStream.pBitStream));
1095210944
};
@@ -11810,19 +11802,18 @@ CBan* CStaticFunctionDefinitions::BanPlayer(CPlayer* pTargetPlayer, bool bIP, bo
1181011802
// Ban the player
1181111803
if (bIP)
1181211804
pBan = m_pBanManager->AddBan(pTargetPlayer, strResponsible, strReason, tUnban);
11813-
else if (bUsername || bSerial)
11805+
else if (bSerial)
1181411806
pBan = m_pBanManager->AddBan(strResponsible, strReason, tUnban);
1181511807

1181611808
// If the ban was successful
1181711809
if (pBan)
1181811810
{
11819-
// Set the data if banned by either username or serial
11820-
if (bUsername)
11821-
pBan->SetAccount(pTargetPlayer->GetSerialUser());
11811+
// Set the data if banned by serial
1182211812
if (bSerial)
11813+
{
1182311814
pBan->SetSerial(pTargetPlayer->GetSerial());
11824-
if (bUsername || bSerial)
1182511815
pBan->SetNick(pTargetPlayer->GetNick());
11816+
}
1182611817

1182711818
// Check if we passed a responsible player
1182811819
if (pResponsible)
@@ -11865,13 +11856,6 @@ CBan* CStaticFunctionDefinitions::BanPlayer(CPlayer* pTargetPlayer, bool bIP, bo
1186511856
bBan = (pBan->GetIP() == pPlayer->GetSourceIP());
1186611857
}
1186711858

11868-
// Check if the player's username matches the specified one, if specified, and he wasn't banned over IP yet
11869-
if (!bBan && bUsername && pBan->GetAccount().length() > 0)
11870-
{
11871-
const std::string& strPlayerUsername = pPlayer->GetSerialUser();
11872-
bBan = stricmp(strPlayerUsername.c_str(), pBan->GetAccount().c_str()) == 0;
11873-
}
11874-
1187511859
// Check if the player's serial matches the specified one, if specified, and he wasn't banned over IP or username yet
1187611860
if (!bBan && bSerial)
1187711861
{
@@ -11956,10 +11940,6 @@ CBan* CStaticFunctionDefinitions::AddBan(SString strIP, SString strUsername, SSt
1195611940
{
1195711941
pBan = m_pBanManager->AddBan(strResponsible, strReason, tUnban);
1195811942
}
11959-
else if (bUsernameSpecified && !m_pBanManager->IsAccountBanned(strUsername))
11960-
{
11961-
pBan = m_pBanManager->AddBan(strResponsible, strReason, tUnban);
11962-
}
1196311943

1196411944
// If the ban was added
1196511945
if (pBan)
@@ -11995,8 +11975,6 @@ CBan* CStaticFunctionDefinitions::AddBan(SString strIP, SString strUsername, SSt
1199511975
strMessage = strMessage.substr(0, 255);
1199611976

1199711977
// Set the account or serial if either one is set to be banned
11998-
if (bUsernameSpecified)
11999-
pBan->SetAccount(strUsername);
1200011978
if (bSerialSpecified)
1200111979
pBan->SetSerial(strSerial);
1200211980

@@ -12046,13 +12024,6 @@ CBan* CStaticFunctionDefinitions::AddBan(SString strIP, SString strUsername, SSt
1204612024
bBan = (strIP == pPlayer->GetSourceIP());
1204712025
}
1204812026

12049-
// Check if the player's username matches the specified one, if specified, and he wasn't banned over IP yet
12050-
if (!bBan && bUsernameSpecified && strUsername.length() > 0)
12051-
{
12052-
const std::string& strPlayerUsername = pPlayer->GetSerialUser();
12053-
bBan = stricmp(strPlayerUsername.c_str(), strUsername.c_str()) == 0;
12054-
}
12055-
1205612027
// Check if the player's serial matches the specified one, if specified, and he wasn't banned over IP or username yet
1205712028
if (!bBan && bSerialSpecified)
1205812029
{
@@ -12168,11 +12139,6 @@ bool CStaticFunctionDefinitions::GetBanSerial(CBan* pBan, SString& strOutSerial)
1216812139

1216912140
bool CStaticFunctionDefinitions::GetBanUsername(CBan* pBan, SString& strOutUsername)
1217012141
{
12171-
if (!pBan->GetAccount().empty())
12172-
{
12173-
strOutUsername = pBan->GetAccount();
12174-
return true;
12175-
}
1217612142
return false;
1217712143
}
1217812144

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ class CStaticFunctionDefinitions
130130
static bool GetPlayerNametagColor(CPlayer* pPlayer, unsigned char& ucR, unsigned char& ucG, unsigned char& ucB);
131131
static bool IsPlayerNametagShowing(CPlayer* pPlayer, bool& bShowing);
132132
static const std::string& GetPlayerSerial(CPlayer* pPlayer, uint uiIndex);
133-
static const std::string& GetPlayerUserName(CPlayer* pPlayer);
134-
static const std::string& GetPlayerCommunityID(CPlayer* pPlayer);
133+
static std::string GetPlayerUserName(CPlayer* pPlayer);
134+
static std::string GetPlayerCommunityID(CPlayer* pPlayer);
135135
static bool GetPlayerBlurLevel(CPlayer* pPlayer, unsigned char& ucLevel);
136136
static bool GetPlayerName(CElement* pElement, SString& strOutName);
137137
static bool GetPlayerIP(CElement* pElement, SString& strOutIP);

0 commit comments

Comments
 (0)