summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/usermanager.cpp52
2 files changed, 14 insertions, 40 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index c40c5fb00..4e4b3f5e2 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -322,8 +322,6 @@ InspIRCd::InspIRCd(int argc, char** argv) :
// Create base manager classes early, so nothing breaks
this->Users = new UserManager;
- this->Users->clientlist = new user_hash();
- this->Users->uuidlist = new user_hash();
this->chanlist = new chan_hash();
this->Config = new ServerConfig;
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index df1d5f9f1..c7d9a61a1 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -25,10 +25,23 @@
#include "bancache.h"
UserManager::UserManager()
- : unregistered_count(0), local_count(0)
+ : clientlist(new user_hash)
+ , uuidlist(new user_hash)
+ , unregistered_count(0), local_count(0)
{
}
+UserManager::~UserManager()
+{
+ for (user_hash::iterator i = clientlist->begin(); i != clientlist->end(); ++i)
+ {
+ delete i->second;
+ }
+
+ delete clientlist;
+ delete uuidlist;
+}
+
/* add a client connection to the sockets list */
void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server)
{
@@ -235,7 +248,6 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char
ServerInstance->Users->uuidlist->erase(user->uuid);
}
-
void UserManager::AddLocalClone(User *user)
{
local_clones[user->GetCIDRMask()]++;
@@ -290,42 +302,6 @@ unsigned long UserManager::LocalCloneCount(User *user)
return 0;
}
-/* this function counts all users connected, wether they are registered or NOT. */
-unsigned int UserManager::UserCount()
-{
- /*
- * XXX: Todo:
- * As part of this restructuring, move clientlist/etc fields into usermanager.
- * -- w00t
- */
- return this->clientlist->size();
-}
-
-/* this counts only registered users, so that the percentages in /MAP don't mess up */
-unsigned int UserManager::RegisteredUserCount()
-{
- return this->clientlist->size() - this->UnregisteredUserCount();
-}
-
-/* return how many users are opered */
-unsigned int UserManager::OperCount()
-{
- return this->all_opers.size();
-}
-
-/* return how many users are unregistered */
-unsigned int UserManager::UnregisteredUserCount()
-{
- return this->unregistered_count;
-}
-
-/* return how many local registered users there are */
-unsigned int UserManager::LocalUserCount()
-{
- /* Doesnt count unregistered clients */
- return (this->local_count - this->UnregisteredUserCount());
-}
-
void UserManager::ServerNoticeAll(const char* text, ...)
{
std::string message;