less lines, same code

This commit is contained in:
aortigos
2026-05-15 22:09:14 +02:00
parent 3bce66fdd0
commit e95cd82211
3 changed files with 12 additions and 19 deletions

View File

@@ -6,7 +6,7 @@
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/05/10 22:06:22 by aortigos #+# #+# */
/* Updated: 2026/05/14 20:21:31 by aortigos ### ########.fr */
/* Updated: 2026/05/15 22:08:49 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,13 +17,11 @@ void Server::pass_cmd(User &client, std::istringstream &ss)
std::string args;
ss >> args;
if (args.empty())
return (client.send(":" SERVER_NAME " 461 * PASS :Not enough parameters\r\n"));
if (client.isAuthenticated())
return (client.send(":" SERVER_NAME " 462 " + client.getNick() + " :Unauthorized command (already registered)\r\n"));
if (args.empty()) return (client.send(":" SERVER_NAME " 461 * PASS :Not enough parameters\r\n"));
if (client.isAuthenticated()) return (client.send(":" SERVER_NAME " 462 " + client.getNick() + " :Unauthorized command (already registered)\r\n"));
if (this->password_ == args)
client.setAuthenticated(true);
else {
else
client.send(":" SERVER_NAME " 464 * :Password incorrect\r\n");
}
}