* Send console output of other clients. * @param origin The origin of the string. * @param string The string that's put on the console. */
| 527 | * @param string The string that's put on the console. |
| 528 | */ |
| 529 | NetworkRecvStatus ServerNetworkAdminSocketHandler::SendConsole(std::string_view origin, std::string_view string) |
| 530 | { |
| 531 | /* If the length of both strings, plus the 2 '\0' terminations and 3 bytes of the packet |
| 532 | * are bigger than the MTU, just ignore the message. Better safe than sorry. It should |
| 533 | * never occur though as the longest strings are chat messages, which are still 30% |
| 534 | * smaller than COMPAT_MTU. */ |
| 535 | if (origin.size() + string.size() + 2 + 3 >= COMPAT_MTU) return NETWORK_RECV_STATUS_OKAY; |
| 536 | |
| 537 | auto p = std::make_unique<Packet>(this, ADMIN_PACKET_SERVER_CONSOLE); |
| 538 | |
| 539 | p->Send_string(origin); |
| 540 | p->Send_string(string); |
| 541 | this->SendPacket(std::move(p)); |
| 542 | |
| 543 | return NETWORK_RECV_STATUS_OKAY; |
| 544 | } |
| 545 | |
| 546 | /** |
| 547 | * Send GameScript JSON output. |
no test coverage detected