| 744 | } |
| 745 | |
| 746 | static bool ConBan(std::span<std::string_view> argv) |
| 747 | { |
| 748 | if (argv.empty()) { |
| 749 | IConsolePrint(CC_HELP, "Ban a client from a network game. Usage: 'ban <ip | client-id> [<ban-reason>]'."); |
| 750 | IConsolePrint(CC_HELP, "For client-id's, see the command 'clients'."); |
| 751 | IConsolePrint(CC_HELP, "If the client is no longer online, you can still ban their IP."); |
| 752 | return true; |
| 753 | } |
| 754 | |
| 755 | if (argv.size() != 2 && argv.size() != 3) return false; |
| 756 | |
| 757 | /* No reason supplied for kicking */ |
| 758 | if (argv.size() == 2) return ConKickOrBan(argv[1], true, {}); |
| 759 | |
| 760 | /* Reason for kicking supplied */ |
| 761 | size_t kick_message_length = argv[2].size(); |
| 762 | if (kick_message_length >= 255) { |
| 763 | IConsolePrint(CC_ERROR, "Maximum kick message length is 254 characters. You entered {} characters.", kick_message_length); |
| 764 | return false; |
| 765 | } else { |
| 766 | return ConKickOrBan(argv[1], true, argv[2]); |
| 767 | } |
| 768 | } |
| 769 | |
| 770 | static bool ConUnBan(std::span<std::string_view> argv) |
| 771 | { |
nothing calls this directly
no test coverage detected