diff options
Diffstat (limited to 'src/irc/irc_user.cpp')
-rw-r--r-- | src/irc/irc_user.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/irc/irc_user.cpp b/src/irc/irc_user.cpp new file mode 100644 index 0000000..fc853bc --- /dev/null +++ b/src/irc/irc_user.cpp @@ -0,0 +1,24 @@ +#include <irc/irc_user.hpp> + +#include <iostream> + +IrcUser::IrcUser(const std::string& name) +{ + const std::string::size_type sep = name.find("!"); + if (sep == std::string::npos) + { + if (name[0] == '@' || name[0] == '+') + this->nick = name.substr(1); + else + this->nick = name; + } + else + { + if (name[0] == '@' || name[0] == '+') + this->nick = name.substr(1, sep); + else + this->nick = name.substr(0, sep); + this->host = name.substr(sep+1); + } + std::cout << "Created user: [" << this->nick << "!" << this->host << std::endl; +} |