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

Method Receive_CLIENT_CHAT

src/network/network_server.cpp:1377–1405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1375}
1376
1377NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_CHAT(Packet &p)
1378{
1379 if (this->status < STATUS_PRE_ACTIVE) {
1380 /* Illegal call, return error and ignore the packet */
1381 return this->SendError(NETWORK_ERROR_NOT_AUTHORIZED);
1382 }
1383
1384 NetworkAction action = (NetworkAction)p.Recv_uint8();
1385 DestType desttype = (DestType)p.Recv_uint8();
1386 int dest = p.Recv_uint32();
1387
1388 Debug(net, 9, "client[{}] Receive_CLIENT_CHAT(): action={}, desttype={}, dest={}", this->client_id, action, desttype, dest);
1389
1390 std::string msg = p.Recv_string(NETWORK_CHAT_LENGTH);
1391 int64_t data = p.Recv_uint64();
1392
1393 NetworkClientInfo *ci = this->GetInfo();
1394 switch (action) {
1395 case NETWORK_ACTION_CHAT:
1396 case NETWORK_ACTION_CHAT_CLIENT:
1397 case NETWORK_ACTION_CHAT_COMPANY:
1398 NetworkServerSendChat(action, desttype, dest, msg, this->client_id, data);
1399 break;
1400 default:
1401 IConsolePrint(CC_WARNING, "Kicking client #{} (IP: {}) due to unknown chact action.", ci->client_id, this->GetClientIP());
1402 return this->SendError(NETWORK_ERROR_NOT_EXPECTED);
1403 }
1404 return NETWORK_RECV_STATUS_OKAY;
1405}
1406
1407NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_SET_NAME(Packet &p)
1408{

Callers

nothing calls this directly

Calls 9

SendErrorMethod · 0.95
GetClientIPMethod · 0.95
NetworkServerSendChatFunction · 0.85
Recv_uint8Method · 0.80
Recv_uint32Method · 0.80
Recv_stringMethod · 0.80
Recv_uint64Method · 0.80
IConsolePrintFunction · 0.50
GetInfoMethod · 0.45

Tested by

no test coverage detected