core_whowas Switch from map to a hash map and from irc::string to std::string

This commit is contained in:
Attila Molnar 2014-07-09 15:16:22 +02:00
parent eef472fb62
commit cf2fd595e0
2 changed files with 6 additions and 6 deletions

View File

@ -46,11 +46,11 @@ namespace WhoWas
/** Nickname whose information is stored in this class
*/
const irc::string nick;
const std::string nick;
/** Constructor to initialize fields
*/
Nick(const irc::string& nickname);
Nick(const std::string& nickname);
/** Destructor, deallocates all elements in the entries container
*/
@ -64,7 +64,7 @@ namespace WhoWas
/** Sets of users in the whowas system
*/
typedef std::map<irc::string, WhoWas::Nick*> whowas_users;
typedef TR1NS::unordered_map<std::string, WhoWas::Nick*, irc::insensitive, irc::StrHashComp> whowas_users;
/** Handle /WHOWAS. These command handlers can be reloaded by the core,
* and handle basic RFC1459 commands. Commands within modules work

View File

@ -40,7 +40,7 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use
return CMD_FAILURE;
}
whowas_users::iterator i = whowas.find(assign(parameters[0]));
whowas_users::iterator i = whowas.find(parameters[0]);
if (i == whowas.end())
{
@ -99,7 +99,7 @@ void CommandWhowas::AddToWhoWas(User* user)
// Insert nick if it doesn't exist
// 'first' will point to the newly inserted element or to the existing element with an equivalent key
std::pair<whowas_users::iterator, bool> ret = whowas.insert(std::make_pair(irc::string(user->nick.c_str()), static_cast<WhoWas::Nick*>(NULL)));
std::pair<whowas_users::iterator, bool> ret = whowas.insert(std::make_pair(user->nick, static_cast<WhoWas::Nick*>(NULL)));
if (ret.second) // If inserted
{
@ -202,7 +202,7 @@ WhoWasGroup::WhoWasGroup(User* user) : host(user->host), dhost(user->dhost), ide
{
}
WhoWas::Nick::Nick(const irc::string& nickname)
WhoWas::Nick::Nick(const std::string& nickname)
: addtime(ServerInstance->Time())
, nick(nickname)
{