mirror of
https://github.com/Ladebeze66/ft_irc.git
synced 2026-11-09 13:17:13 +01:00
join
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/15 12:41:35 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/05/15 12:48:40 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/05/17 20:08:13 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -16,23 +16,27 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
|
||||
class Client;
|
||||
|
||||
class Channel {
|
||||
public:
|
||||
Channel(const std::string &name);
|
||||
~Channel();
|
||||
Channel(const std::string &name);
|
||||
~Channel();
|
||||
|
||||
const std::string &getName() const;
|
||||
void addClient(Client *client);
|
||||
void removeClient(Client *client);
|
||||
bool isEmpty() const;
|
||||
const std::vector<Client *> &getClients() const;
|
||||
const std::string &getName() const;
|
||||
void addClient(Client *client);
|
||||
void removeClient(Client *client);
|
||||
bool isEmpty() const;
|
||||
const std::vector<Client *> &getClients() const;
|
||||
void addOperator(Client *client);
|
||||
bool isOperator(Client *client) const;
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
std::vector<Client *> _clients;
|
||||
std::string _name;
|
||||
std::vector<Client *> _clients;
|
||||
std::vector<Client *> _operators;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/15 12:15:42 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/05/16 18:18:02 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/05/17 17:21:39 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -18,32 +18,30 @@
|
||||
class Client
|
||||
{
|
||||
public:
|
||||
Client(int fd);
|
||||
Client(int fd, const std::string &nickname, const std::string &user);
|
||||
|
||||
void setPassword(const std::string &password);
|
||||
const std::string &getPassword() const;
|
||||
|
||||
void setNickname(const std::string &nickname);
|
||||
const std::string &getNickname() const;
|
||||
|
||||
void setUser(const std::string &user);
|
||||
const std::string &getUser() const;
|
||||
|
||||
void setRealName(const std::string &realname);
|
||||
const std::string &getRealName() const;
|
||||
|
||||
bool isAuthenticated() const;
|
||||
void authenticate();
|
||||
|
||||
int getFd() const;
|
||||
int getFd() const;
|
||||
const std::string &getNickname() const;
|
||||
void setNickname(const std::string &nickname);
|
||||
const std::string &getUser() const;
|
||||
void setUser(const std::string &user);
|
||||
const std::string &getPassword() const;
|
||||
void setPassword(const std::string &password);
|
||||
const std::string &getRealName() const;
|
||||
void setRealName(const std::string &realname);
|
||||
bool isAuthenticated() const;
|
||||
void authenticate();
|
||||
bool isOperator() const;
|
||||
void setOperator(bool isOperator);
|
||||
|
||||
private:
|
||||
int _fd;
|
||||
std::string _password;
|
||||
std::string _nickname;
|
||||
std::string _user;
|
||||
std::string _realname;
|
||||
bool _authenticated;
|
||||
int _fd;
|
||||
std::string _nickname;
|
||||
std::string _user;
|
||||
std::string _password;
|
||||
std::string _realname;
|
||||
bool _authenticated;
|
||||
bool _operator;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/15 18:30:07 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/05/16 16:26:03 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/05/17 18:51:44 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -35,9 +35,11 @@ class ClientManager
|
||||
public:
|
||||
ClientManager(Server *server);
|
||||
void acceptClient();
|
||||
void broadcastChannelList(Client *client);
|
||||
void handleClient(int client_fd);
|
||||
void removeClient(int client_fd);
|
||||
|
||||
|
||||
private:
|
||||
Server *_server;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/15 18:14:12 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/05/16 17:35:46 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/05/17 17:10:38 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -18,12 +18,15 @@
|
||||
#include "Client.hpp"
|
||||
#include "Channel.hpp"
|
||||
#include "AdditionalCommands.hpp"
|
||||
#include "ModeWhoHandler.hpp"
|
||||
#include "CommandHandler.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
class Server;
|
||||
class ModeWhoHandler;
|
||||
|
||||
class CommandHandler
|
||||
{
|
||||
|
||||
34
ft_irc3/includes/ModeWhoHandler.hpp
Normal file
34
ft_irc3/includes/ModeWhoHandler.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ModeWhoHandler.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/17 16:08:48 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/05/17 18:08:06 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MODEWHOHANDLER_HPP
|
||||
#define MODEWHOHANDLER_HPP
|
||||
|
||||
#include "Server.hpp"
|
||||
#include "Client.hpp"
|
||||
#include "Channel.hpp"
|
||||
#include "Utils.hpp"
|
||||
|
||||
class Server;
|
||||
|
||||
class ModeWhoHandler
|
||||
{
|
||||
public:
|
||||
ModeWhoHandler(Server *server);
|
||||
void handleModeCommand(Client *client, const std::string &command);
|
||||
void handleWhoCommand(Client *client, const std::string &command);
|
||||
|
||||
private:
|
||||
Server *_server;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/15 12:15:13 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/05/16 17:40:34 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/05/17 20:03:06 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -51,6 +51,9 @@ public:
|
||||
std::map<std::string, Channel *> &getChannels();
|
||||
std::map<int, Client *> &getClients();
|
||||
const std::string &getPassword() const;
|
||||
void broadcast(const std::string &message);
|
||||
Client* getClientByName(const std::string &name); // Ajoutez cette méthode
|
||||
void sendChannelListToClient(Client *client);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user