Disable chat for the first 5s (configurable) after joining a server.
This commit is contained in:
@@ -476,6 +476,10 @@ namespace OpenRA.Server
|
||||
LobbyInfo.Clients.Add(client);
|
||||
newConn.Validated = true;
|
||||
|
||||
// Disable chat UI to stop the client sending messages that we know we will reject
|
||||
if (!client.IsAdmin && Settings.JoinChatDelay > 0)
|
||||
DispatchOrdersToClient(newConn, 0, 0, new Order("DisableChatEntry", null, false) { ExtraData = (uint)Settings.JoinChatDelay }.Serialize());
|
||||
|
||||
Log.Write("server", "Client {0}: Accepted connection from {1}.", newConn.PlayerIndex, newConn.EndPoint);
|
||||
|
||||
if (client.Fingerprint != null)
|
||||
@@ -892,8 +896,19 @@ namespace OpenRA.Server
|
||||
}
|
||||
|
||||
case "Chat":
|
||||
DispatchOrdersToClients(conn, 0, o.Serialize());
|
||||
break;
|
||||
{
|
||||
var isAdmin = GetClient(conn)?.IsAdmin ?? false;
|
||||
var connected = conn.ConnectionTimer.ElapsedMilliseconds;
|
||||
if (!isAdmin && connected < Settings.JoinChatDelay)
|
||||
{
|
||||
var remaining = (Settings.JoinChatDelay - connected + 999) / 1000;
|
||||
SendOrderTo(conn, "Message", "Chat is disabled. Please try again in {0} seconds".F(remaining));
|
||||
}
|
||||
else
|
||||
DispatchOrdersToClients(conn, 0, o.Serialize());
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "GameSaveTraitData":
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user