MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SendExternalChat

Method SendExternalChat

src/network/network_server.cpp:705–720  ·  view source on GitHub ↗

* 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 message. * @param msg The actual message. */

Source from the content-addressed store, hash-verified

703 * @param msg The actual message.
704 */
705NetworkRecvStatus ServerNetworkGameSocketHandler::SendExternalChat(std::string_view source, TextColour colour, std::string_view user, std::string_view msg)
706{
707 Debug(net, 9, "client[{}] SendExternalChat(): source={}", this->client_id, source);
708
709 if (this->status < STATUS_PRE_ACTIVE) return NETWORK_RECV_STATUS_OKAY;
710
711 auto p = std::make_unique<Packet>(this, PACKET_SERVER_EXTERNAL_CHAT);
712
713 p->Send_string(source);
714 p->Send_uint16(colour);
715 p->Send_string(user);
716 p->Send_string(msg);
717
718 this->SendPacket(std::move(p));
719 return NETWORK_RECV_STATUS_OKAY;
720}
721
722/**
723 * Tell the client another client quit with an error.

Callers 1

Calls 3

Send_stringMethod · 0.80
Send_uint16Method · 0.80
SendPacketMethod · 0.45

Tested by

no test coverage detected