68 lines
1.9 KiB
C++
68 lines
1.9 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* Channel.hpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: aortigos <aortigos@student.42malaga.com> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2026/05/08 16:41:40 by aortigos #+# #+# */
|
|
/* Updated: 2026/05/08 16:41:40 by aortigos ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef CHANNEL_HPP
|
|
|
|
# define CHANNEL_HPP
|
|
|
|
# include <iostream>
|
|
# include <set>
|
|
# include <map>
|
|
|
|
# include "../User/User.hpp"
|
|
|
|
class Channel
|
|
{
|
|
private:
|
|
std::string name_;
|
|
|
|
std::set<int> members_;
|
|
std::set<int> operators_;
|
|
|
|
bool isInviteOnly_;
|
|
std::set<int> invitedMembers_;
|
|
|
|
public:
|
|
Channel();
|
|
Channel(std::string &name);
|
|
Channel(const Channel &other);
|
|
Channel& operator=(const Channel &other);
|
|
~Channel();
|
|
|
|
|
|
// Getters
|
|
std::string getName() const;
|
|
const std::set<int> &getMembers() const;
|
|
|
|
// Users
|
|
void addMember(int fd);
|
|
void removeMember(int fd);
|
|
bool hasMember(int fd) const;
|
|
|
|
// Operators
|
|
void addOperator(int fd);
|
|
void removeOperator(int fd);
|
|
bool hasOperator(int fd) const;
|
|
|
|
void broadcast(const std::string &msg, const std::map<int, User> &clients, int excludedFd);
|
|
|
|
// modes
|
|
void setMode(std::string& mode, std::string& args);
|
|
|
|
void inviteMember(const User& client);
|
|
bool isInviteOnly() const;
|
|
bool isInvited(int fd) const;
|
|
|
|
};
|
|
|
|
#endif
|