* Trim the given client name in place, i.e. remove leading and trailing spaces. * After the trim check whether the client name is valid. A client name is valid * whenever the name is not empty and does not start with spaces. This check is * done via \c NetworkIsValidClientName. * When the client name is valid, this function returns true. * When the client name is not valid a GUI error message
| 1265 | * @return True iff the client name is valid. |
| 1266 | */ |
| 1267 | bool NetworkValidateClientName(std::string &client_name) |
| 1268 | { |
| 1269 | StrTrimInPlace(client_name); |
| 1270 | if (NetworkIsValidClientName(client_name)) return true; |
| 1271 | |
| 1272 | ShowErrorMessage(GetEncodedString(STR_NETWORK_ERROR_BAD_PLAYER_NAME), {}, WL_ERROR); |
| 1273 | return false; |
| 1274 | } |
| 1275 | |
| 1276 | /** |
| 1277 | * Convenience method for NetworkValidateClientName on _settings_client.network.client_name. |
no test coverage detected