This commit is contained in:
2024-01-22 21:27:47 +01:00
parent 66fa3f494f
commit 2cda614d92
3 changed files with 12 additions and 9 deletions

View File

@@ -6,7 +6,7 @@
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/21 10:35:52 by maldavid #+# #+# */
/* Updated: 2024/01/22 20:43:08 by vvaas ### ########.fr */
/* Updated: 2024/01/22 20:52:52 by vvaas ### ########.fr */
/* */
/******************************************************************************/
@@ -23,7 +23,7 @@ namespace irc
void Client::sendCode(const std::string& code, const std::string &msg)
{
const std::string command = code + " :" + msg;
send(_fd, command, command.size(), 0);
send(_fd, command.c_str(), command.size(), 0);
}
void Client::printUserHeader() const

View File

@@ -6,7 +6,7 @@
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/20 09:27:04 by maldavid #+# #+# */
/* Updated: 2024/01/22 17:26:47 by vvaas ### ########.fr */
/* Updated: 2024/01/22 21:04:13 by vvaas ### ########.fr */
/* */
/******************************************************************************/
@@ -51,6 +51,5 @@ int main(int ac, char** av)
signal(SIGQUIT, signalsHandler);
serv->wait();
serv->closeMainSocket();
return 0;
}

View File

@@ -1,14 +1,14 @@
/* ************************************************************************** */
/******************************************************************************/
/* */
/* ::: :::::::: */
/* server_functions.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/22 17:31:06 by maldavid #+# #+# */
/* Updated: 2024/01/22 20:19:50 by maldavid ### ########.fr */
/* Updated: 2024/01/22 21:09:56 by vvaas ### ########.fr */
/* */
/* ************************************************************************** */
/******************************************************************************/
#include <server.hpp>
#include <client.hpp>
@@ -22,6 +22,8 @@
#include <config.hpp>
#include <message.hpp>
#include <algorithm>
#include <errorscode.hpp>
#include <irc.hpp>
namespace irc
{
@@ -36,7 +38,8 @@ namespace irc
{
if((*it)->getNickName() == msg.getTokens()[1])
{
// collision
client->sendCode(ERR_NICKCOLLISION, "Nickname is used");
return ;
}
}
client->printUserHeader();
@@ -170,6 +173,7 @@ namespace irc
void Server::handleTopic(unstd::SharedPtr<class Client> client, const Message& msg)
{
(void)client;
if(msg.getTokens().size() == 1)
{
logs::report(log_error, "TOPIC, invalid command '%s'", msg.getRawMsg().c_str());