|
@@ -668,12 +668,34 @@ NetworkRecvStatus ServerNetworkGameSocke
|
|
|
|
|
|
this->SendPacket(p);
|
|
|
return NETWORK_RECV_STATUS_OKAY;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Send a chat message from external source.
|
|
|
* @param source Name of the source this message came from.
|
|
|
* @param colour TextColour to use for the message.
|
|
|
* @param user Name of the user who sent the messsage.
|
|
|
* @param msg The actual message.
|
|
|
*/
|
|
|
NetworkRecvStatus ServerNetworkGameSocketHandler::SendExternalChat(const std::string &source, TextColour colour, const std::string &user, const std::string &msg)
|
|
|
{
|
|
|
if (this->status < STATUS_PRE_ACTIVE) return NETWORK_RECV_STATUS_OKAY;
|
|
|
|
|
|
Packet *p = new Packet(PACKET_SERVER_EXTERNAL_CHAT);
|
|
|
|
|
|
p->Send_string(source);
|
|
|
p->Send_uint16(colour);
|
|
|
p->Send_string(user);
|
|
|
p->Send_string(msg);
|
|
|
|
|
|
this->SendPacket(p);
|
|
|
return NETWORK_RECV_STATUS_OKAY;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Tell the client another client quit with an error.
|
|
|
* @param client_id The client that quit.
|
|
|
* @param errorno The reason the client quit.
|
|
|
*/
|
|
|
NetworkRecvStatus ServerNetworkGameSocketHandler::SendErrorQuit(ClientID client_id, NetworkErrorCode errorno)
|
|
|
{
|
|
@@ -1259,18 +1281,33 @@ void NetworkServerSendChat(NetworkAction
|
|
|
}
|
|
|
|
|
|
NetworkAdminChat(action, desttype, from_id, msg, data, from_admin);
|
|
|
|
|
|
ci = NetworkClientInfo::GetByClientID(from_id);
|
|
|
if (ci != nullptr) {
|
|
|
NetworkTextMessage(action, GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
|
|
|
NetworkTextMessage(action, GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data, "");
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Send a chat message from external source.
|
|
|
* @param source Name of the source this message came from.
|
|
|
* @param colour TextColour to use for the message.
|
|
|
* @param user Name of the user who sent the messsage.
|
|
|
* @param msg The actual message.
|
|
|
*/
|
|
|
void NetworkServerSendExternalChat(const std::string &source, TextColour colour, const std::string &user, const std::string &msg)
|
|
|
{
|
|
|
for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) {
|
|
|
cs->SendExternalChat(source, colour, user, msg);
|
|
|
}
|
|
|
NetworkTextMessage(NETWORK_ACTION_EXTERNAL_CHAT, colour, false, user, msg, 0, source);
|
|
|
}
|
|
|
|
|
|
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_CHAT(Packet *p)
|
|
|
{
|
|
|
if (this->status < STATUS_PRE_ACTIVE) {
|
|
|
/* Illegal call, return error and ignore the packet */
|
|
|
return this->SendError(NETWORK_ERROR_NOT_AUTHORIZED);
|
|
|
}
|