Fixed error messages in commands
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/04/17 11:58:23 by aortigos #+# #+# */
|
||||
/* Updated: 2026/04/17 11:58:40 by aortigos ### ########.fr */
|
||||
/* Updated: 2026/04/17 13:10:07 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -21,19 +21,24 @@ void Server::cmd_user(int fd, std::istringstream &ss)
|
||||
|
||||
if (clients[fd].getNick().empty())
|
||||
{
|
||||
send(fd, ERR_NONICK.c_str(), ERR_NONICK.size(), 0);
|
||||
std::string msg = ":ircserv 451 * :You have not registered\r\n";
|
||||
send(fd, msg.c_str(), msg.size(), 0);
|
||||
return ;
|
||||
}
|
||||
|
||||
if(clients[fd].isRegistered())
|
||||
{
|
||||
send(fd, ERR_REREGISTER.c_str(), ERR_REREGISTER.size(), 0);
|
||||
std::string msg = ":ircserv 462 "
|
||||
+ clients[fd].getNick()
|
||||
+ " :You may not reregister\r\n";
|
||||
send(fd, msg.c_str(), msg.size(), 0);
|
||||
return ;
|
||||
}
|
||||
|
||||
if (username.empty())
|
||||
{
|
||||
send(fd, ERR_NOUSER.c_str(), ERR_NOUSER.size(), 0);
|
||||
std::string msg = ":ircserv 461 * USER :Not enough parameters\r\n";
|
||||
send(fd, msg.c_str(), msg.size(), 0);
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -42,6 +47,10 @@ void Server::cmd_user(int fd, std::istringstream &ss)
|
||||
clients[fd].setRealname(realname);
|
||||
clients[fd].setRegistered(true);
|
||||
|
||||
std::string msg = "You has been registered!\r\n";
|
||||
std::string msg = ":ircserv 001 "
|
||||
+ clients[fd].getNick()
|
||||
+ " :Welcome to IRC "
|
||||
+ clients[fd].getNick()
|
||||
+ "\r\n";
|
||||
send(fd, msg.c_str(), msg.size(), 0);
|
||||
}
|
||||
Reference in New Issue
Block a user