gg
This commit is contained in:
@@ -6,7 +6,11 @@
|
|||||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/01/21 10:36:21 by maldavid #+# #+# */
|
/* 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 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");
|
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, const std::string& reason, bool quit)
|
||||||
|
=======
|
||||||
|
bool Channel::removeClient(unstd::SharedPtr<Client> client)
|
||||||
|
>>>>>>> Stashed changes
|
||||||
{
|
{
|
||||||
if(!_clients.erase(client))
|
if(!_clients.erase(client))
|
||||||
return false;
|
return (false);
|
||||||
if(isOp(client))
|
if(isOp(client))
|
||||||
_operators.erase(client);
|
_operators.erase(client);
|
||||||
for(client_it it = _clients.begin(); it != _clients.end(); ++it)
|
for(client_it it = _clients.begin(); it != _clients.end(); ++it)
|
||||||
|
<<<<<<< Updated upstream
|
||||||
{
|
{
|
||||||
if(!quit)
|
if(!quit)
|
||||||
const_cast<unstd::SharedPtr<irc::Client>&>(*it)->sendMsg(client->getNickName(), "PART", _name + ' ' + reason);
|
const_cast<unstd::SharedPtr<irc::Client>&>(*it)->sendMsg(client->getNickName(), "PART", _name + ' ' + reason);
|
||||||
@@ -87,6 +96,11 @@ namespace irc
|
|||||||
if(!quit)
|
if(!quit)
|
||||||
client->sendMsg(client->getNickName(), "PART", _name + ' ' + reason);
|
client->sendMsg(client->getNickName(), "PART", _name + ' ' + reason);
|
||||||
return true;
|
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)
|
void Channel::sendWho(unstd::SharedPtr<Client> client)
|
||||||
|
|||||||
@@ -6,7 +6,11 @@
|
|||||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/01/21 09:31:17 by maldavid #+# #+# */
|
/* 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: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>::iterator channel_it;
|
||||||
typedef std::vector<Channel>::const_iterator channel_const_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));
|
std::memset(&_s_data, 0, sizeof(sockaddr));
|
||||||
initSocket();
|
initSocket();
|
||||||
}
|
}
|
||||||
@@ -108,6 +117,8 @@ namespace irc
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
socklen_t len = sizeof(sockaddr_in);
|
socklen_t len = sizeof(sockaddr_in);
|
||||||
|
|
||||||
|
if (_main_socket == NULL_SOCKET)
|
||||||
|
return ;
|
||||||
while(_active)
|
while(_active)
|
||||||
{
|
{
|
||||||
FD_ZERO(&_fd_set);
|
FD_ZERO(&_fd_set);
|
||||||
|
|||||||
@@ -6,7 +6,11 @@
|
|||||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/01/22 17:31:06 by maldavid #+# #+# */
|
/* 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 21:01:20 by maldavid ### ########.fr */
|
||||||
|
=======
|
||||||
|
/* Updated: 2024/01/30 20:39:22 by vvaas ### ########.fr */
|
||||||
|
>>>>>>> Stashed changes
|
||||||
/* */
|
/* */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user