Adding join channels and privmsg
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/04/17 16:26:18 by aortigos #+# #+# */
|
||||
/* Updated: 2026/04/17 18:44:02 by aortigos ### ########.fr */
|
||||
/* Updated: 2026/04/17 18:54:46 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -20,15 +20,26 @@ void Server::cmd_join(int fd, std::istringstream &ss)
|
||||
|
||||
if (!clients[fd].isRegistered())
|
||||
{
|
||||
std::string msg = "You are not registered";
|
||||
std::string msg = "You are not registered\r\n";
|
||||
send(fd, msg.c_str(), msg.size(), 0);
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
if (channels.find(channelName) == channels.end())
|
||||
if (channels.find(args) == channels.end())
|
||||
{
|
||||
channels.insert(std::make_pair(args, Channel(args)));
|
||||
channels[args].addMember(fd);
|
||||
|
||||
std::string msg = "Channel created\r\n";
|
||||
send(fd, msg.c_str(), msg.size(), 0);
|
||||
} else {
|
||||
channels[args].addMember(fd);
|
||||
|
||||
std::string msg = "Channel already exists\r\n";
|
||||
send(fd, msg.c_str(), msg.size(), 0);
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user