mirror of
https://github.com/Ladebeze66/ft_irc.git
synced 2025-12-17 06:28:03 +01:00
dd
This commit is contained in:
parent
826de5d786
commit
9b86506abf
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/21 18:09:05 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/06/10 13:28:55 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/06/11 13:30:49 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include "TopicHandler.hpp"
|
||||
#include "KickHandler.hpp"
|
||||
#include "BotFilter.hpp"
|
||||
#include "Join.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/21 19:51:08 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/06/01 18:51:10 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/06/11 13:50:53 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include "Server.hpp"
|
||||
#include "Channel.hpp"
|
||||
#include "Client.hpp"
|
||||
#include "AdditionalCommands.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/15 12:15:13 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/06/06 18:51:31 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/06/11 13:33:28 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -78,6 +78,7 @@ class Server
|
||||
ModeHandler *_modeHandler;
|
||||
TopicHandler *_topicHandler;
|
||||
BotFilter *_botFilter;
|
||||
AdditionalCommands *_additionalCommands;
|
||||
|
||||
friend class ClientManager;
|
||||
friend class CommandHandler;
|
||||
|
||||
BIN
ft_irc3/ircserv
Executable file
BIN
ft_irc3/ircserv
Executable file
Binary file not shown.
0
ft_irc3/logs/irc_server.log
Normal file
0
ft_irc3/logs/irc_server.log
Normal file
BIN
ft_irc3/obj/AdditionalCommands.o
Normal file
BIN
ft_irc3/obj/AdditionalCommands.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/BotFilter.o
Normal file
BIN
ft_irc3/obj/BotFilter.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/Channel.o
Normal file
BIN
ft_irc3/obj/Channel.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/Client.o
Normal file
BIN
ft_irc3/obj/Client.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/ClientManager.o
Normal file
BIN
ft_irc3/obj/ClientManager.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/CommandHandler.o
Normal file
BIN
ft_irc3/obj/CommandHandler.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/InviteHandler.o
Normal file
BIN
ft_irc3/obj/InviteHandler.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/Join.o
Normal file
BIN
ft_irc3/obj/Join.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/KickHandler.o
Normal file
BIN
ft_irc3/obj/KickHandler.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/ModeHandler.o
Normal file
BIN
ft_irc3/obj/ModeHandler.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/Server.o
Normal file
BIN
ft_irc3/obj/Server.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/TopicHandler.o
Normal file
BIN
ft_irc3/obj/TopicHandler.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/Utils.o
Normal file
BIN
ft_irc3/obj/Utils.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/Welcome.o
Normal file
BIN
ft_irc3/obj/Welcome.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/Who.o
Normal file
BIN
ft_irc3/obj/Who.o
Normal file
Binary file not shown.
BIN
ft_irc3/obj/main.o
Normal file
BIN
ft_irc3/obj/main.o
Normal file
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/16 15:27:29 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/06/10 15:17:13 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/06/11 11:45:43 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -206,7 +206,7 @@ void AdditionalCommands::handlePrivmsgCommand(Server *server, Client *client, co
|
||||
if (channelClients[i] != client)
|
||||
{
|
||||
std::stringstream privMsg;
|
||||
privMsg << ":" << client->getNickname() << " PRIVMSG " << target << " :" << message << "\r\n";
|
||||
privMsg << ":" << client->getNickname() << " PRIVMSG " << target << message << "\r\n";
|
||||
server->sendToClient(channelClients[i]->getFd(), privMsg.str());
|
||||
_server->log("Sent PRIVMSG to " + channelClients[i]->getNickname(), GREEN);
|
||||
}
|
||||
@ -229,7 +229,7 @@ void AdditionalCommands::handlePrivmsgCommand(Server *server, Client *client, co
|
||||
}
|
||||
|
||||
std::stringstream privMsg;
|
||||
privMsg << ":" << client->getNickname() << " PRIVMSG " << target << " :" << message << "\r\n";
|
||||
privMsg << ":" << client->getNickname() << " PRIVMSG " << target << message << "\r\n";
|
||||
server->sendToClient(targetClient->getFd(), privMsg.str());
|
||||
_server->log("Sent PRIVMSG to " + targetClient->getNickname(), GREEN);
|
||||
|
||||
|
||||
@ -46,7 +46,6 @@ void JoinHandler::handleJoinCommand(Client* client, const std::string& params, S
|
||||
|
||||
if (channelName[0] == '0' && channelName.size() == 1)
|
||||
{
|
||||
// Leave all channels
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/30 11:13:08 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/06/08 22:12:20 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/06/11 11:27:28 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -158,13 +158,13 @@ void ModeHandler::applyModeL(Client *client, Channel* channel, bool adding, cons
|
||||
}
|
||||
std::ostringstream oss;
|
||||
oss << limit;
|
||||
_server->sendToClient(client->getFd(), MODEACCEPTMESSAGE(client, channel->getName(), "+l", " " + argument));
|
||||
channel->broadcast(MODEACCEPTMESSAGE(client, channel->getName(), "+l", "" + argument), NULL, _server);
|
||||
_server->log("Applying mode L: Setting limit to " + oss.str(), GREEN);
|
||||
channel->setClientLimit(limit);
|
||||
}
|
||||
else
|
||||
{
|
||||
_server->sendToClient(client->getFd(), MODEACCEPTMESSAGE(client, channel->getName(), "-l", " " + argument));
|
||||
channel->broadcast(MODEACCEPTMESSAGE(client, channel->getName(), "-l", "" + argument), NULL, _server);
|
||||
_server->log("Applying mode L: Removing limit", RED);
|
||||
channel->setClientLimit(0);
|
||||
}
|
||||
@ -179,7 +179,7 @@ void ModeHandler::applyModeI(Client *client, Channel *channel, bool adding)
|
||||
isAlreadySet = channel->isInviteOnly() == adding;
|
||||
if (!isAlreadySet)
|
||||
{
|
||||
_server->sendToClient(client->getFd(), MODEACCEPTMESSAGE(client, channel->getName(), modeChange, ""));
|
||||
channel->broadcast(MODEACCEPTMESSAGE(client, channel->getName(), modeChange, ""), NULL, _server);
|
||||
_server->log("Applying mode I: " + std::string(adding ? "Setting invite-only" : "Removing invite-only"), GREEN);
|
||||
channel->setInviteOnly(adding);
|
||||
}
|
||||
@ -210,7 +210,7 @@ void ModeHandler::applyModeK(Client *client, Channel *channel, bool adding, cons
|
||||
_server->log("Invalid key for mode +k: contains spaces", RED);
|
||||
return;
|
||||
}
|
||||
_server->sendToClient(client->getFd(), MODEACCEPTMESSAGE(client, channel->getName(), "+k ", argument));
|
||||
channel->broadcast( MODEACCEPTMESSAGE(client, channel->getName(), "+k ", argument), NULL, _server);
|
||||
_server->log("Applying mode K: Setting key to " + argument, GREEN);
|
||||
channel->setKey(argument);
|
||||
}
|
||||
|
||||
@ -6,14 +6,14 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/15 12:17:12 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/06/06 18:44:57 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/06/11 13:34:13 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Server.hpp"
|
||||
|
||||
Server::Server(int port, const std::string &password)
|
||||
: _port(port), _password(password), _clientManager(new ClientManager(this)), _commandHandler(new CommandHandler(this)), _modeHandler(new ModeHandler(this)), _topicHandler(new TopicHandler(this)), _botFilter(new BotFilter(this))
|
||||
: _port(port), _password(password), _clientManager(new ClientManager(this)), _commandHandler(new CommandHandler(this)), _modeHandler(new ModeHandler(this)), _topicHandler(new TopicHandler(this)), _botFilter(new BotFilter(this)), _additionalCommands(new AdditionalCommands(this))
|
||||
{
|
||||
initServer();
|
||||
_botFilter = new BotFilter(this);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user