modifjoinchannel

This commit is contained in:
Ladebeze66
2024-05-28 13:14:17 +02:00
parent fb982d0770
commit b938c46c92
6 changed files with 129 additions and 28 deletions

View File

@@ -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/21 19:26:51 by fgras-ca ### ########.fr */
/* Updated: 2024/05/28 11:13:12 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,6 +17,7 @@
#include <vector>
#include <algorithm>
#include <set>
#include <ctime>
#include "RPL.hpp"
#include "Client.hpp"
@@ -38,13 +39,33 @@ public:
const std::vector<Client *> &getClients() const;
void addOperator(Client *client);
bool isOperator(Client *client) const;
bool hasClient(Client *client) const; // Ajouté
void broadcast(const std::string &message, Client *_client, Server *_server); // Ajouté
bool hasClient(Client *client) const;
void broadcast(const std::string &message, Client *_client, Server *_server);
// Ajouts
bool isBanned(Client *client) const;
bool isFull() const;
bool isInviteOnly() const;
bool isInvited(Client *client) const;
bool checkKey(const std::string &key) const;
const std::string &getTopic() const;
const std::string &getTopicSetter() const;
time_t getTopicTime() const;
void setTopic(const std::string &topic, const std::string &setter);
private:
std::string _name;
std::vector<Client *> _clients;
std::vector<Client *> _operators;
std::set<Client *> _bannedClients;
std::set<Client *> _invitedClients;
std::string _key;
std::string _topic;
std::string _topicSetter;
time_t _topicTime;
size_t _clientLimit;
bool _inviteOnly;
};
#endif // CHANNEL_HPP

View File

@@ -6,28 +6,26 @@
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/21 19:51:08 by fgras-ca #+# #+# */
/* Updated: 2024/05/21 20:13:15 by fgras-ca ### ########.fr */
/* Updated: 2024/05/28 11:09:22 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef JOIN_HPP
#define JOIN_HPP
#include "Server.hpp"
#include <string>
#include "Client.hpp"
#include "Server.hpp"
#include "Channel.hpp"
#include "RPL.hpp"
class Server;
class Client;
class Channel;
class JoinHandler
{
public:
void handleJoinCommand(Client *client, const std::string &channelName, Server *server);
private:
void sendJoinSuccess(Client *client, Channel *channel, Server *server);
std::string getUsersList(Channel *channel);
};