MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / ServerHandleChat

Method ServerHandleChat

src/openrct2/network/NetworkBase.cpp:2954–2982  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2952 }
2953
2954 void NetworkBase::ServerHandleChat(Connection& connection, Packet& packet)
2955 {
2956 auto szText = packet.readString();
2957 if (szText.empty())
2958 return;
2959
2960 if (connection.player != nullptr)
2961 {
2962 NetworkGroup* group = GetGroupByID(connection.player->group);
2963 if (group == nullptr || !group->canPerformAction(Permission::chat))
2964 {
2965 return;
2966 }
2967 }
2968
2969 std::string text(szText);
2970 if (connection.player != nullptr)
2971 {
2972 if (!ProcessChatMessagePluginHooks(connection.player->id, text))
2973 {
2974 // Message not to be relayed
2975 return;
2976 }
2977 }
2978
2979 const char* formatted = FormatChat(connection.player, text.c_str());
2980 ChatAddHistory(formatted);
2981 ServerSendChat(formatted);
2982 }
2983
2984 void NetworkBase::Client_Handle_GAME_ACTION([[maybe_unused]] Connection& connection, Packet& packet)
2985 {

Callers

nothing calls this directly

Calls 5

ChatAddHistoryFunction · 0.85
canPerformActionMethod · 0.80
readStringMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected