Allow telling client the banned reason for the future
This commit is contained in:
@@ -836,9 +836,19 @@ void ClientLobby::connectionRefused(Event* event)
|
||||
_("Connection refused: Server is busy."));
|
||||
break;
|
||||
case RR_BANNED:
|
||||
STKHost::get()->setErrorMessage(
|
||||
_("Connection refused: You are banned from the server."));
|
||||
{
|
||||
core::stringw msg =
|
||||
_("Connection refused: You are banned from the server.");
|
||||
core::stringw reason;
|
||||
data.decodeStringW(&reason);
|
||||
if (!reason.empty())
|
||||
{
|
||||
msg += L"\n";
|
||||
msg += reason;
|
||||
}
|
||||
STKHost::get()->setErrorMessage(msg);
|
||||
break;
|
||||
}
|
||||
case RR_INCORRECT_PASSWORD:
|
||||
STKHost::get()->setErrorMessage(
|
||||
_("Connection refused: Server password is incorrect."));
|
||||
|
||||
@@ -2116,6 +2116,9 @@ void ServerLobby::connectionRequested(Event* event)
|
||||
NetworkString *message = getNetworkString(2);
|
||||
message->setSynchronous(true);
|
||||
message->addUInt8(LE_CONNECTION_REFUSED).addUInt8(RR_BANNED);
|
||||
// For future we can say the reason here
|
||||
// and use encodeString instead
|
||||
message->addUInt8(0);
|
||||
peer->cleanPlayerProfiles();
|
||||
peer->sendPacket(message, true/*reliable*/, false/*encrypted*/);
|
||||
peer->reset();
|
||||
|
||||
Reference in New Issue
Block a user