| 721 | } |
| 722 | |
| 723 | static bool ConKick(std::span<std::string_view> argv) |
| 724 | { |
| 725 | if (argv.empty()) { |
| 726 | IConsolePrint(CC_HELP, "Kick a client from a network game. Usage: 'kick <ip | client-id> [<kick-reason>]'."); |
| 727 | IConsolePrint(CC_HELP, "For client-id's, see the command 'clients'."); |
| 728 | return true; |
| 729 | } |
| 730 | |
| 731 | if (argv.size() != 2 && argv.size() != 3) return false; |
| 732 | |
| 733 | /* No reason supplied for kicking */ |
| 734 | if (argv.size() == 2) return ConKickOrBan(argv[1], false, {}); |
| 735 | |
| 736 | /* Reason for kicking supplied */ |
| 737 | size_t kick_message_length = argv[2].size(); |
| 738 | if (kick_message_length >= 255) { |
| 739 | IConsolePrint(CC_ERROR, "Maximum kick message length is 254 characters. You entered {} characters.", kick_message_length); |
| 740 | return false; |
| 741 | } else { |
| 742 | return ConKickOrBan(argv[1], false, argv[2]); |
| 743 | } |
| 744 | } |
| 745 | |
| 746 | static bool ConBan(std::span<std::string_view> argv) |
| 747 | { |
nothing calls this directly
no test coverage detected