Fixed banned IPs method.
This commit is contained in:
@@ -532,7 +532,7 @@ void StepManiaLanServer::NewClientCheck()
|
||||
if (server.accept(Client[CurrentEmptyClient].clientSocket) == 1)
|
||||
Client[CurrentEmptyClient].Used = 1;
|
||||
|
||||
if (IsBanned(Client[CurrentEmptyClient].clientSocket.GetIn_addr()))
|
||||
if (IsBanned(Client[CurrentEmptyClient].clientSocket.address))
|
||||
Client[CurrentEmptyClient].Disconnect();
|
||||
|
||||
}
|
||||
@@ -879,19 +879,19 @@ void StepManiaLanServer::Ban(CString &name)
|
||||
{
|
||||
for (int x = 0; x < NUMBERCLIENTS; ++x)
|
||||
if (Client[x].Used)
|
||||
for (int y = 0; y < 2; y++)
|
||||
for (int y = 0; y < 2; ++y)
|
||||
if (name == Client[x].Player[y].name)
|
||||
{
|
||||
ServerChat("Banned " + name + ".");
|
||||
bannedIPs.push_back(Client[x].clientSocket.GetIn_addr());
|
||||
bannedIPs.push_back(Client[x].clientSocket.address);
|
||||
Client[x].Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
bool StepManiaLanServer::IsBanned(in_addr &ip)
|
||||
bool StepManiaLanServer::IsBanned(CString &ip)
|
||||
{
|
||||
for (unsigned int x = 0; x < bannedIPs.size(); ++x)
|
||||
if (ip.S_un.S_addr == bannedIPs[x].S_un.S_addr)
|
||||
if (ip == bannedIPs[x])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ private:
|
||||
bool StatsNameChange;
|
||||
bool SecondSameSelect;
|
||||
int numPlayers;
|
||||
vector<in_addr> bannedIPs;
|
||||
vector<CString> bannedIPs;
|
||||
|
||||
void Hello(PacketFunctions& Packet, int clientNum);
|
||||
void UpdateClients();
|
||||
@@ -129,7 +129,7 @@ private:
|
||||
CString StepManiaLanServer::ListPlayers();
|
||||
void Kick(CString &name);
|
||||
void Ban(CString &name);
|
||||
bool IsBanned(in_addr &ip);
|
||||
bool IsBanned(CString &ip);
|
||||
void ForceStart();
|
||||
bool CheckCheat(int clientNum);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user