This commit is contained in:
2024-01-30 21:04:26 +01:00
parent 20fc70ab90
commit 6bb885a845
3 changed files with 31 additions and 2 deletions

View File

@@ -6,7 +6,11 @@
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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> client, const std::string& reason, bool quit)
=======
bool Channel::removeClient(unstd::SharedPtr<Client> 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<unstd::SharedPtr<irc::Client>&>(*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<unstd::SharedPtr<irc::Client>&>(*it)->sendMsg(client->getNickName(), "PART", _name);
client->sendMsg(client->getNickName(), "PART", _name);
return (true);
>>>>>>> Stashed changes
}
void Channel::sendWho(unstd::SharedPtr<Client> client)

View File

@@ -6,7 +6,11 @@
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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<Channel>::iterator channel_it;
typedef std::vector<Channel>::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);

View File

@@ -6,7 +6,11 @@
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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
/* */
/******************************************************************************/