|
|
|
@ -670,6 +670,28 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendChat(NetworkAction action,
|
|
|
|
|
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.
|
|
|
|
@ -1262,12 +1284,27 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|