now broadcast send message to every member of channel, excluding the author of message
This commit is contained in:
@@ -57,7 +57,14 @@ 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()
|
||||
void Channel::broadcast(const std::string &msg, std::map<int, User> &clients, int excludedFd)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
for (std::set<int>::iterator member = members_.begin(); member != members_.end(); member++)
|
||||
{
|
||||
if ((*member) == excludedFd) continue;
|
||||
std::map<int, User>::iterator user = clients.find(*member);
|
||||
|
||||
if (user != clients.end())
|
||||
user->second.send(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class Channel
|
||||
void removeOperator(int fd);
|
||||
bool hasOperator(int fd) const;
|
||||
|
||||
void broadcast();
|
||||
void broadcast(const std::string &msg, std::map<int, User> &clients, int excludedFd);
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user