Implement part and join, both ways

This commit is contained in:
Florent Le Coz
2013-11-09 23:17:48 +01:00
parent f38b31a63e
commit 7c67149935
10 changed files with 148 additions and 12 deletions
+24
View File
@@ -22,3 +22,27 @@ IrcUser* IrcChannel::get_self() const
{
return this->self.get();
}
IrcUser* IrcChannel::find_user(const std::string& name)
{
IrcUser user(name);
for (const auto& u: this->users)
{
if (u->nick == user.nick)
return u.get();
}
return nullptr;
}
void IrcChannel::remove_user(const IrcUser* user)
{
for (auto it = this->users.begin(); it != this->users.end(); ++it)
{
IrcUser* u = it->get();
if (u->nick == user->nick)
{
this->users.erase(it);
break ;
}
}
}