Add: [Network] external chat messages for remote admins (#9563)

This commit is contained in:
dP
2021-09-20 00:09:06 +03:00
committed by GitHub
parent d9f8ed7bdf
commit 31cf9e888b
16 changed files with 112 additions and 5 deletions

View File

@@ -217,7 +217,7 @@ bool NetworkCompanyIsPassworded(CompanyID company_id)
/* This puts a text-message to the console, or in the future, the chat-box,
* (to keep it all a bit more general)
* If 'self_send' is true, this is the client who is sending the message */
void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send, const std::string &name, const std::string &str, int64 data)
void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send, const std::string &name, const std::string &str, int64 data, const std::string &data_str)
{
StringID strid;
switch (action) {
@@ -248,6 +248,7 @@ void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send,
case NETWORK_ACTION_CHAT_COMPANY: strid = self_send ? STR_NETWORK_CHAT_TO_COMPANY : STR_NETWORK_CHAT_COMPANY; break;
case NETWORK_ACTION_CHAT_CLIENT: strid = self_send ? STR_NETWORK_CHAT_TO_CLIENT : STR_NETWORK_CHAT_CLIENT; break;
case NETWORK_ACTION_KICKED: strid = STR_NETWORK_MESSAGE_KICKED; break;
case NETWORK_ACTION_EXTERNAL_CHAT: strid = STR_NETWORK_CHAT_EXTERNAL; break;
default: strid = STR_NETWORK_CHAT_ALL; break;
}
@@ -255,6 +256,7 @@ void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send,
SetDParamStr(0, name);
SetDParamStr(1, str);
SetDParam(2, data);
SetDParamStr(3, data_str);
/* All of these strings start with "***". These characters are interpreted as both left-to-right and
* right-to-left characters depending on the context. As the next text might be an user's name, the
@@ -265,7 +267,7 @@ void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send,
Debug(desync, 1, "msg: {:08x}; {:02x}; {}", _date, _date_fract, message);
IConsolePrint(colour, message);
NetworkAddChatMessage((TextColour)colour, _settings_client.gui.network_chat_timeout, message);
NetworkAddChatMessage(colour, _settings_client.gui.network_chat_timeout, message);
}
/* Calculate the frame-lag of a client */