diff --git a/Server/Server.cpp b/Server/Server.cpp index 15bfec9..677b7e2 100644 --- a/Server/Server.cpp +++ b/Server/Server.cpp @@ -6,7 +6,7 @@ /* By: aortigos > args; + if (args.empty()) + return (client.send(":" SERVER_NAME " 431 * :Not nickname given\r\n")); + // Invalid characters in nick + // 432 * badnick : Erroneous nickname + // If nick exists + // 4233 * takenick :Nickname is already in use + if (client.getUsername()) + return (); // Broadcast in channels :oldnick!user@host NICK newnick +} \ No newline at end of file diff --git a/cmds/pass.cpp b/cmds/pass.cpp index 7b409c2..d842bd5 100644 --- a/cmds/pass.cpp +++ b/cmds/pass.cpp @@ -6,7 +6,7 @@ /* By: aortigos > args; + if (args.empty()) + return (client.send(":" SERVER_NAME " 461 * PASS :Not enough parameters\r\n")); if (client.isAuthenticated()) - { - // Still need to find what server should reply to different errors - client.send("You are already logged in\r\n"); - return ; - } + return (client.send(":" SERVER_NAME " 462 " + client.getNick() + " :Unauthorized command (already registered)\r\n")); if (this->password_ == args) client.setAuthenticated(true); else { - // Still need to find what server should reply to different errors - client.send("Invalid password\r\n"); - send(client.getFd(), res.c_str(), res.size(), 0); + client.send(":" SERVER_NAME " 464 * :Password incorrect\r\n"); } } \ No newline at end of file