From cf2fd595e08ff181f062bb238aea646ed719d946 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 9 Jul 2014 15:16:22 +0200 Subject: [PATCH] core_whowas Switch from map to a hash map and from irc::string to std::string --- include/commands/cmd_whowas.h | 6 +++--- src/coremods/core_whowas.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h index 021e9e3b7..8e1a8059d 100644 --- a/include/commands/cmd_whowas.h +++ b/include/commands/cmd_whowas.h @@ -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 whowas_users; +typedef TR1NS::unordered_map whowas_users; /** Handle /WHOWAS. These command handlers can be reloaded by the core, * and handle basic RFC1459 commands. Commands within modules work diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp index a27eb4341..6c16ca1a3 100644 --- a/src/coremods/core_whowas.cpp +++ b/src/coremods/core_whowas.cpp @@ -40,7 +40,7 @@ CmdResult CommandWhowas::Handle (const std::vector& 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 ret = whowas.insert(std::make_pair(irc::string(user->nick.c_str()), static_cast(NULL))); + std::pair ret = whowas.insert(std::make_pair(user->nick, static_cast(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) { -- 2.39.2