diff --git a/srcs/channel.cpp b/srcs/channel.cpp index b4ce4ed..3374aae 100644 --- a/srcs/channel.cpp +++ b/srcs/channel.cpp @@ -6,7 +6,11 @@ /* By: vvaas +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/21 10:36:21 by maldavid #+# #+# */ +<<<<<<< Updated upstream /* Updated: 2024/01/30 21:01:06 by maldavid ### ########.fr */ +======= +/* Updated: 2024/01/30 20:39:37 by vvaas ### ########.fr */ +>>>>>>> Stashed changes /* */ /******************************************************************************/ @@ -71,13 +75,18 @@ namespace irc client->sendCode(ERR_USERNOTINCHANNEL, "User not in channel"); } +<<<<<<< Updated upstream bool Channel::removeClient(unstd::SharedPtr client, const std::string& reason, bool quit) +======= + bool Channel::removeClient(unstd::SharedPtr client) +>>>>>>> Stashed changes { if(!_clients.erase(client)) - return false; + return (false); if(isOp(client)) _operators.erase(client); for(client_it it = _clients.begin(); it != _clients.end(); ++it) +<<<<<<< Updated upstream { if(!quit) const_cast&>(*it)->sendMsg(client->getNickName(), "PART", _name + ' ' + reason); @@ -87,6 +96,11 @@ namespace irc if(!quit) client->sendMsg(client->getNickName(), "PART", _name + ' ' + reason); return true; +======= + const_cast&>(*it)->sendMsg(client->getNickName(), "PART", _name); + client->sendMsg(client->getNickName(), "PART", _name); + return (true); +>>>>>>> Stashed changes } void Channel::sendWho(unstd::SharedPtr client) diff --git a/srcs/server.cpp b/srcs/server.cpp index b3ed7d7..8b398cd 100644 --- a/srcs/server.cpp +++ b/srcs/server.cpp @@ -6,7 +6,11 @@ /* By: vvaas +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/21 09:31:17 by maldavid #+# #+# */ +<<<<<<< Updated upstream /* Updated: 2024/01/30 20:58:31 by maldavid ### ########.fr */ +======= +/* Updated: 2024/01/30 20:27:37 by vvaas ### ########.fr */ +>>>>>>> Stashed changes /* */ /******************************************************************************/ @@ -28,8 +32,13 @@ namespace irc typedef std::vector::iterator channel_it; typedef std::vector::const_iterator channel_const_it; - Server::Server(int port, const std::string& password) : _s_len(sizeof(_s_data)), _password(password), _port(port), _active(true) + Server::Server(int port, const std::string& password) : _s_len(sizeof(_s_data)), _password(password), _port(port), _main_socket(NULL_SOCKET), _active(true) { + if (password.empty() || password.find_first_of(" \t\r\v") != std::string::npos) + { + logs::report(log_error, "Password is invalid !"); + return ; + } std::memset(&_s_data, 0, sizeof(sockaddr)); initSocket(); } @@ -108,6 +117,8 @@ namespace irc int i = 0; socklen_t len = sizeof(sockaddr_in); + if (_main_socket == NULL_SOCKET) + return ; while(_active) { FD_ZERO(&_fd_set); diff --git a/srcs/server_functions.cpp b/srcs/server_functions.cpp index dcd60bb..6b37682 100644 --- a/srcs/server_functions.cpp +++ b/srcs/server_functions.cpp @@ -6,7 +6,11 @@ /* By: vvaas +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/22 17:31:06 by maldavid #+# #+# */ +<<<<<<< Updated upstream /* Updated: 2024/01/30 21:01:20 by maldavid ### ########.fr */ +======= +/* Updated: 2024/01/30 20:39:22 by vvaas ### ########.fr */ +>>>>>>> Stashed changes /* */ /******************************************************************************/