| 585 | } |
| 586 | |
| 587 | String CommandProcessor::kick(ConnectionId connectionId, String const& argumentString) { |
| 588 | if (auto errorMsg = adminCheck(connectionId, "kick a user")) |
| 589 | return *errorMsg; |
| 590 | |
| 591 | auto arguments = m_parser.tokenizeToStringList(argumentString); |
| 592 | |
| 593 | if (arguments.empty()) |
| 594 | return "No player specified"; |
| 595 | |
| 596 | auto toKick = playerCidFromCommand(arguments[0], m_universe); |
| 597 | if (!toKick) |
| 598 | return strf("No user with specifier {} found.", arguments[0]); |
| 599 | |
| 600 | // Like IRC, if only the nick is passed then the nick is used as the reason |
| 601 | if (arguments.size() == 1) |
| 602 | arguments.append(m_universe->clientNick(*toKick)); |
| 603 | |
| 604 | m_universe->disconnectClient(*toKick, arguments[1]); |
| 605 | |
| 606 | return strf("Successfully kicked user with specifier {}. ConnectionId: {}. Reason given: {}", |
| 607 | arguments[0], |
| 608 | toKick, |
| 609 | arguments[1]); |
| 610 | } |
| 611 | |
| 612 | String CommandProcessor::ban(ConnectionId connectionId, String const& argumentString) { |
| 613 | if (auto errorMsg = adminCheck(connectionId, "ban a user")) |
nothing calls this directly
no test coverage detected