Improving commands and added quit

This commit is contained in:
aortigos
2026-05-16 11:47:45 +02:00
parent 3de8940560
commit 66bd57bfde
9 changed files with 108 additions and 11 deletions

View File

@@ -43,6 +43,7 @@ User& User::operator=(const User &other)
buffer = other.buffer;
authenticated = other.authenticated;
registered = other.registered;
channels_ = other.channels_;
}
// std::cout << "User copy assignment operator called" << std::endl;
return (*this);
@@ -59,6 +60,27 @@ void User::send(const std::string &msg)
::send(fd, msg.c_str(), msg.size(), 0);
}
// Channels
void User::joinChannel(const std::string &channel)
{
channels_.insert(channel);
}
void User::leaveChannel(const std::string &channel)
{
channels_.erase(channel);
}
bool User::isInChannel(const std::string &channel) const
{
return (channels_.count(channel) > 0);
}
const std::set<std::string> &User::getChannels() const
{
return (channels_);
}
// Getters
int User::getFd() const { return (this->fd); }