summaryrefslogtreecommitdiff
path: root/src/irc/irc_channel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/irc/irc_channel.cpp')
-rw-r--r--src/irc/irc_channel.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/irc/irc_channel.cpp b/src/irc/irc_channel.cpp
index 223305b..6daf708 100644
--- a/src/irc/irc_channel.cpp
+++ b/src/irc/irc_channel.cpp
@@ -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 ;
+ }
+ }
+}