Doing join command
This commit is contained in:
@@ -41,11 +41,11 @@ Channel& Channel::operator=(const Channel &other)
|
||||
|
||||
// Constructor with name
|
||||
|
||||
Channel::Channel(std::string name) : name_(name) { /* std::cout << "Channel with name constructor called" << std::endl; */ }
|
||||
Channel::Channel(std::string &name) : name_(name) { /* std::cout << "Channel with name constructor called" << std::endl; */ }
|
||||
|
||||
|
||||
// Getters
|
||||
std::string Channel::getName() const { return (this->name); }
|
||||
std::string Channel::getName() const { return (this->name_); }
|
||||
|
||||
// Members
|
||||
void Channel::addMember(int fd) { this->members_.insert(fd); }
|
||||
@@ -57,13 +57,7 @@ void Channel::addOperator(int fd) { this->operators_.insert(fd); }
|
||||
void Channel::removeOperator(int fd) { this->operators_.erase(fd); }
|
||||
bool Channel::hasOperator(int fd) const { return (this->operators_.count(fd) > 0); }
|
||||
|
||||
void Channel::broadcast(const std::string &msg, const std::map<int, User>& clients_, int excludeFd)
|
||||
void Channel::broadcast()
|
||||
{
|
||||
for(std::set<int>::iterator it = members_.begin(); it != members_.end(); it++)
|
||||
{
|
||||
if (*it == excludeFd) continue;
|
||||
std::map<int, User>::const_iterator user = clients_.find(*it);
|
||||
if (user != client_.end())
|
||||
user->second.send(msg);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
Reference in New Issue
Block a user