summaryrefslogtreecommitdiff
path: root/src/irc/irc_user.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-01-04 01:30:03 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-01-04 01:59:36 +0100
commite840704b58a984351971e8034e74f5e9fdfaf114 (patch)
tree9b038d0003e175b640cddd8de0d7814dde8eaf51 /src/irc/irc_user.cpp
parentbaf03a7e20d30698a06ccf03cd93b15317de340e (diff)
downloadbiboumi-e840704b58a984351971e8034e74f5e9fdfaf114.tar.gz
biboumi-e840704b58a984351971e8034e74f5e9fdfaf114.tar.bz2
biboumi-e840704b58a984351971e8034e74f5e9fdfaf114.tar.xz
biboumi-e840704b58a984351971e8034e74f5e9fdfaf114.zip
Convert received modes into roles and affiliations
Diffstat (limited to 'src/irc/irc_user.cpp')
-rw-r--r--src/irc/irc_user.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/irc/irc_user.cpp b/src/irc/irc_user.cpp
index 934988a..0f1b1ee 100644
--- a/src/irc/irc_user.cpp
+++ b/src/irc/irc_user.cpp
@@ -25,3 +25,23 @@ IrcUser::IrcUser(const std::string& name):
IrcUser(name, {})
{
}
+
+void IrcUser::add_mode(const char mode)
+{
+ this->modes.insert(mode);
+}
+
+void IrcUser::remove_mode(const char mode)
+{
+ this->modes.erase(mode);
+}
+
+char IrcUser::get_most_significant_mode(const std::vector<char>& modes) const
+{
+ for (const char mode: modes)
+ {
+ if (this->modes.find(mode) != this->modes.end())
+ return mode;
+ }
+ return 0;
+}