IRC nicks cannot contain spaces

Rather than trying and hoping the server gives a proper failure, just
fail early and avoid the whole mess. Some servers will instead send
messages to the user, etc, which is not very helpful.
This commit is contained in:
Stephen Paul Weber
2026-09-23 21:58:20 -05:00
parent 99d7f8a41a
commit d8bc3d17bb
2 changed files with 18 additions and 0 deletions
+5
View File
@@ -526,6 +526,11 @@ void IrcClient::send_user_command(const std::string& username, const std::string
void IrcClient::send_nick_command(const std::string& nick)
{
if (nick.find(' ') != std::string::npos)
{
this->on_erroneous_nickname(IrcMessage(std::string(this->hostname), "432", {this->get_own_nick(), nick, "Erroneous nickname"}));
return;
}
this->send_message(IrcMessage("NICK", {nick}));
}