Use isupport informations to know the user modes when joining
Also remove the duplicate send_self_join methods, user only send_user_join
This commit is contained in:
+15
-15
@@ -2,26 +2,26 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
IrcUser::IrcUser(const std::string& name)
|
||||
IrcUser::IrcUser(const std::string& name,
|
||||
const std::map<char, char>& prefix_to_mode)
|
||||
{
|
||||
if (name.empty())
|
||||
return ;
|
||||
const std::string::size_type sep = name.find("!");
|
||||
const std::map<char, char>::const_iterator prefix = prefix_to_mode.find(name[0]);
|
||||
const size_t name_begin = prefix == prefix_to_mode.end()? 0: 1;
|
||||
if (sep == std::string::npos)
|
||||
{
|
||||
if (name[0] == '~' || name[0] == '&'
|
||||
|| name[0] == '@' || name[0] == '%'
|
||||
|| name[0] == '+')
|
||||
this->nick = name.substr(1);
|
||||
else
|
||||
this->nick = name;
|
||||
}
|
||||
this->nick = name.substr(name_begin);
|
||||
else
|
||||
{
|
||||
if (name[0] == '~' || name[0] == '&'
|
||||
|| name[0] == '@' || name[0] == '%'
|
||||
|| name[0] == '+')
|
||||
this->nick = name.substr(1, sep);
|
||||
else
|
||||
this->nick = name.substr(0, sep);
|
||||
this->nick = name.substr(name_begin, sep);
|
||||
this->host = name.substr(sep+1);
|
||||
}
|
||||
if (prefix != prefix_to_mode.end())
|
||||
this->modes.insert(prefix->second);
|
||||
}
|
||||
|
||||
IrcUser::IrcUser(const std::string& name):
|
||||
IrcUser(name, {})
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user