Added MODE and invite only functionality

This commit is contained in:
iherman-
2026-05-23 18:39:18 +02:00
parent 982ca33116
commit dd4de38e5f
9 changed files with 124 additions and 36 deletions

View File

@@ -3,10 +3,10 @@
/* ::: :::::::: */
/* Server.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* By: iherman- <iherman-@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/05/06 17:19:12 by iherman- #+# #+# */
/* Updated: 2026/05/16 11:31:25 by aortigos ### ########.fr */
/* Updated: 2026/05/23 18:03:11 by iherman- ### ########.fr */
/* */
/* ************************************************************************** */
@@ -118,6 +118,7 @@ Server::Server(int port, const std::string& password) :
commands_["JOIN"] = &Server::join_cmd;
commands_["QUIT"] = &Server::quit_cmd;
commands_["PRIVMSG"] = &Server::privmsg_cmd;
commands_["MODE"] = & Server::mode_cmd;
std::cout << "Server port: " << port_
<< "\nServer Password: " << password_
@@ -233,6 +234,8 @@ std::vector<struct pollfd>::iterator Server::removeClient(std::vector<struct pol
std::cout << "Client with fd: " << client->fd << " disconnected " << std::endl;
// should also remove client from all channels its in
clients_.erase(client->fd);
return (sockets_.erase(client));
}

View File

@@ -3,10 +3,10 @@
/* ::: :::::::: */
/* Server.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* By: iherman- <iherman-@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/05/06 17:18:11 by iherman- #+# #+# */
/* Updated: 2026/05/16 11:45:11 by aortigos ### ########.fr */
/* Updated: 2026/05/23 17:16:21 by iherman- ### ########.fr */
/* */
/* ************************************************************************** */
@@ -67,6 +67,7 @@ class Server
void join_cmd(User &client, std::istringstream &ss);
void privmsg_cmd(User &client, std::istringstream &ss);
void quit_cmd(User &client, std::istringstream &ss);
void mode_cmd(User &client, std::istringstream &ss);
public: