summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/usermanager.h13
-rw-r--r--src/helperfuncs.cpp8
-rw-r--r--src/modules/m_spanningtree/uid.cpp2
-rw-r--r--src/usermanager.cpp15
-rw-r--r--src/users.cpp8
5 files changed, 19 insertions, 27 deletions
diff --git a/include/usermanager.h b/include/usermanager.h
index 15d41e6bc..040f91852 100644
--- a/include/usermanager.h
+++ b/include/usermanager.h
@@ -32,18 +32,17 @@ class CoreExport UserManager
clonemap local_clones;
public:
- /** Constructor, initializes variables and allocates the hashmaps
+ /** Constructor, initializes variables
*/
UserManager();
- /** Destructor, destroys all users in clientlist and then deallocates
- * the hashmaps
+ /** Destructor, destroys all users in clientlist
*/
~UserManager();
/** Client list, a hash_map containing all clients, local and remote
*/
- user_hash* clientlist;
+ user_hash clientlist;
/** Client list stored by UUID. Contains all clients, and is updated
* automatically by the constructor and destructor of User.
@@ -135,12 +134,12 @@ class CoreExport UserManager
/** Return a count of all global users, unknown and known connections
* @return The number of users on the network, including local unregistered users
*/
- unsigned int UserCount() const { return this->clientlist->size(); }
+ unsigned int UserCount() const { return this->clientlist.size(); }
/** Return a count of fully registered connections on the network
* @return The number of registered users on the network
*/
- unsigned int RegisteredUserCount() { return this->clientlist->size() - this->UnregisteredUserCount(); }
+ unsigned int RegisteredUserCount() { return this->clientlist.size() - this->UnregisteredUserCount(); }
/** Return a count of opered (umode +o) users on the network
* @return The number of opers on the network
@@ -160,7 +159,7 @@ class CoreExport UserManager
/** Get a hash map containing all users, keyed by their nickname
* @return A hash map mapping nicknames to User pointers
*/
- user_hash& GetUsers() { return *clientlist; }
+ user_hash& GetUsers() { return clientlist; }
/** Send a server notice to all local users
* @param text The text format string to send
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 567806efc..bebb22007 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -38,9 +38,9 @@ User* InspIRCd::FindNick(const std::string &nick)
if (!nick.empty() && isdigit(*nick.begin()))
return FindUUID(nick);
- user_hash::iterator iter = this->Users->clientlist->find(nick);
+ user_hash::iterator iter = this->Users->clientlist.find(nick);
- if (iter == this->Users->clientlist->end())
+ if (iter == this->Users->clientlist.end())
/* Couldn't find it */
return NULL;
@@ -49,9 +49,9 @@ User* InspIRCd::FindNick(const std::string &nick)
User* InspIRCd::FindNickOnly(const std::string &nick)
{
- user_hash::iterator iter = this->Users->clientlist->find(nick);
+ user_hash::iterator iter = this->Users->clientlist.find(nick);
- if (iter == this->Users->clientlist->end())
+ if (iter == this->Users->clientlist.end())
return NULL;
return iter->second;
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index 37c54ae60..f248b3860 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -77,7 +77,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::st
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Duplicate UUID %s in client introduction", params[0].c_str());
return CMD_INVALID;
}
- (*(ServerInstance->Users->clientlist))[params[2]] = _new;
+ ServerInstance->Users->clientlist[params[2]] = _new;
_new->nick = params[2];
_new->host = params[3];
_new->dhost = params[4];
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index 2a9f02cfd..ee6eafbb5 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -26,19 +26,16 @@
#include "iohook.h"
UserManager::UserManager()
- : clientlist(new user_hash)
- , unregistered_count(0)
+ : unregistered_count(0)
{
}
UserManager::~UserManager()
{
- for (user_hash::iterator i = clientlist->begin(); i != clientlist->end(); ++i)
+ for (user_hash::iterator i = clientlist.begin(); i != clientlist.end(); ++i)
{
delete i->second;
}
-
- delete clientlist;
}
/* add a client connection to the sockets list */
@@ -70,7 +67,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
/* The users default nick is their UUID */
New->nick = New->uuid;
- (*(this->clientlist))[New->nick] = New;
+ this->clientlist[New->nick] = New;
New->registered = REG_NONE;
New->signon = ServerInstance->Time() + ServerInstance->Config->dns_timeout;
@@ -199,11 +196,7 @@ void UserManager::QuitUser(User* user, const std::string& quitreason, const std:
ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s (%s) [%s]", user->GetFullRealHost().c_str(), user->GetIPString().c_str(), operreason->c_str());
}
- user_hash::iterator iter = this->clientlist->find(user->nick);
-
- if (iter != this->clientlist->end())
- this->clientlist->erase(iter);
- else
+ if (!clientlist.erase(user->nick))
ServerInstance->Logs->Log("USERS", LOG_DEFAULT, "ERROR: Nick not found in clientlist, cannot remove: " + user->nick);
uuidlist.erase(user->uuid);
diff --git a/src/users.cpp b/src/users.cpp
index e760a3fbc..6a31f0a93 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -697,8 +697,8 @@ bool User::ChangeNick(const std::string& newnick, bool force, time_t newts)
InUse->WriteTo(InUse, "NICK %s", InUse->uuid.c_str());
InUse->WriteNumeric(ERR_NICKNAMEINUSE, "%s :Nickname overruled.", InUse->nick.c_str());
- ServerInstance->Users->clientlist->erase(InUse->nick);
- (*(ServerInstance->Users->clientlist))[InUse->uuid] = InUse;
+ ServerInstance->Users->clientlist.erase(InUse->nick);
+ ServerInstance->Users->clientlist[InUse->uuid] = InUse;
InUse->nick = InUse->uuid;
InUse->InvalidateCache();
@@ -721,8 +721,8 @@ bool User::ChangeNick(const std::string& newnick, bool force, time_t newts)
nick = newnick;
InvalidateCache();
- ServerInstance->Users->clientlist->erase(oldnick);
- (*(ServerInstance->Users->clientlist))[newnick] = this;
+ ServerInstance->Users->clientlist.erase(oldnick);
+ ServerInstance->Users->clientlist[newnick] = this;
if (registered == REG_ALL)
FOREACH_MOD(OnUserPostNick, (this,oldnick));