summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-07-19 14:28:51 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-07-19 14:28:51 +0200
commite5ada400b0f2e2ae02f40867450a6789126da6e3 (patch)
tree2bb90da3198a359c4c0ea95bf3bfc8731808f7a4 /src
parentbc8664c5c49f4ac9adbc5e3937a584e4a6b35614 (diff)
Access local user list via new UserManager::GetLocalUsers() and make local_users private
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_privmsg.cpp2
-rw-r--r--src/coremods/core_stats.cpp2
-rw-r--r--src/coremods/core_wallops.cpp3
-rw-r--r--src/helperfuncs.cpp3
-rw-r--r--src/inspircd.cpp4
-rw-r--r--src/modules/extra/m_geoip.cpp7
-rw-r--r--src/modules/m_close.cpp3
-rw-r--r--src/modules/m_jumpserver.cpp3
-rw-r--r--src/modules/m_modenotice.cpp3
-rw-r--r--src/modules/m_nationalchars.cpp3
-rw-r--r--src/modules/m_spanningtree/main.cpp4
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp2
-rw-r--r--src/xline.cpp13
13 files changed, 32 insertions, 20 deletions
diff --git a/src/coremods/core_privmsg.cpp b/src/coremods/core_privmsg.cpp
index 5ec3097a5..34527027c 100644
--- a/src/coremods/core_privmsg.cpp
+++ b/src/coremods/core_privmsg.cpp
@@ -67,7 +67,7 @@ class MessageCommandBase : public Command
void MessageCommandBase::SendAll(User* user, const std::string& msg, MessageType mt)
{
const std::string message = ":" + user->GetFullHost() + " " + MessageTypeString[mt] + " $* :" + msg;
- const UserManager::LocalList& list = ServerInstance->Users->local_users;
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
{
if ((*i)->registered == REG_ALL)
diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp
index 0034889ab..1192b1be9 100644
--- a/src/coremods/core_stats.cpp
+++ b/src/coremods/core_stats.cpp
@@ -54,7 +54,7 @@ static void GenerateStatsLl(User* user, string_list& results, char c)
{
results.push_back(InspIRCd::Format("211 %s nick[ident@%s] sendq cmds_out bytes_out cmds_in bytes_in time_open", user->nick.c_str(), (c == 'l' ? "host" : "ip")));
- const UserManager::LocalList& list = ServerInstance->Users->local_users;
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
{
LocalUser* u = *i;
diff --git a/src/coremods/core_wallops.cpp b/src/coremods/core_wallops.cpp
index 871a6e60e..0210df8ee 100644
--- a/src/coremods/core_wallops.cpp
+++ b/src/coremods/core_wallops.cpp
@@ -55,7 +55,8 @@ CmdResult CommandWallops::Handle (const std::vector<std::string>& parameters, Us
std::string wallop("WALLOPS :");
wallop.append(parameters[0]);
- for (UserManager::LocalList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
{
User* t = *i;
if (t->IsModeSet(wallopsmode))
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 55a1b9f83..7b2a29f77 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -82,7 +82,8 @@ Channel* InspIRCd::FindChan(const std::string &chan)
/* Send an error notice to all users, registered or not */
void InspIRCd::SendError(const std::string &s)
{
- for (UserManager::LocalList::const_iterator i = this->Users->local_users.begin(); i != this->Users->local_users.end(); ++i)
+ const UserManager::LocalList& list = Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
{
User* u = *i;
if (u->registered == REG_ALL)
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index fec4aedea..403ba5355 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -109,8 +109,8 @@ void InspIRCd::Cleanup()
ports.clear();
/* Close all client sockets, or the new process inherits them */
- UserManager::LocalList& list = Users->local_users;
- for (UserManager::LocalList::iterator i = list.begin(); i != list.end(); ++i)
+ const UserManager::LocalList& list = Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
Users->QuitUser(*i, "Server shutdown");
GlobalCulls.Apply();
diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp
index f8e358bf7..3561d1a5d 100644
--- a/src/modules/extra/m_geoip.cpp
+++ b/src/modules/extra/m_geoip.cpp
@@ -56,7 +56,8 @@ class ModuleGeoIP : public Module
if (gi == NULL)
throw ModuleException("Unable to initialize geoip, are you missing GeoIP.dat?");
- for (UserManager::LocalList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
{
LocalUser* user = *i;
if ((user->registered == REG_ALL) && (!ext.get(user)))
@@ -101,7 +102,9 @@ class ModuleGeoIP : public Module
unsigned int unknown = 0;
std::map<std::string, unsigned int> results;
- for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
+
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
{
std::string* cc = ext.get(*i);
if (cc)
diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp
index f8bac669d..f3c751f17 100644
--- a/src/modules/m_close.cpp
+++ b/src/modules/m_close.cpp
@@ -35,7 +35,8 @@ class CommandClose : public Command
{
std::map<std::string,int> closed;
- for (UserManager::LocalList::const_iterator u = ServerInstance->Users->local_users.begin(); u != ServerInstance->Users->local_users.end(); ++u)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator u = list.begin(); u != list.end(); ++u)
{
LocalUser* user = *u;
if (user->registered != REG_ALL)
diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp
index 9ee224704..599144448 100644
--- a/src/modules/m_jumpserver.cpp
+++ b/src/modules/m_jumpserver.cpp
@@ -108,7 +108,8 @@ class CommandJumpserver : public Command
if (redirect_all_immediately)
{
/* Redirect everyone but the oper sending the command */
- for (UserManager::LocalList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
{
LocalUser* t = *i;
if (!t->IsOper())
diff --git a/src/modules/m_modenotice.cpp b/src/modules/m_modenotice.cpp
index 0078c6325..056eb4a62 100644
--- a/src/modules/m_modenotice.cpp
+++ b/src/modules/m_modenotice.cpp
@@ -32,7 +32,8 @@ class CommandModeNotice : public Command
{
std::string msg = "*** From " + src->nick + ": " + parameters[1];
int mlen = parameters[0].length();
- for (UserManager::LocalList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
{
User* user = *i;
for (int n = 0; n < mlen; n++)
diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp
index 3efd97a24..0650cb3d0 100644
--- a/src/modules/m_nationalchars.cpp
+++ b/src/modules/m_nationalchars.cpp
@@ -261,7 +261,8 @@ class ModuleNationalChars : public Module
if (!forcequit)
return;
- for (UserManager::LocalList::const_iterator iter = ServerInstance->Users->local_users.begin(); iter != ServerInstance->Users->local_users.end(); ++iter)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator iter = list.begin(); iter != list.end(); ++iter)
{
/* Fix by Brain: Dont quit UID users */
User* n = *iter;
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index b24d8c6ee..8a1aed08f 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -62,7 +62,7 @@ namespace
// Does not change the server of quitting users because those are not in the list
ServerInstance->FakeClient->server = newserver;
- const UserManager::LocalList& list = ServerInstance->Users->local_users;
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
(*i)->server = newserver;
}
@@ -70,7 +70,7 @@ namespace
void ResetMembershipIds()
{
// Set all membership ids to 0
- const UserManager::LocalList& list = ServerInstance->Users->local_users;
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
for (UserManager::LocalList::iterator i = list.begin(); i != list.end(); ++i)
{
LocalUser* user = *i;
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index 589e9b889..74854acc9 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -38,7 +38,7 @@ TreeServer::TreeServer()
, VersionString(ServerInstance->GetVersionString())
, fullversion(ServerInstance->GetVersionString(true))
, Socket(NULL), sid(ServerInstance->Config->GetSID()), ServerUser(ServerInstance->FakeClient)
- , age(ServerInstance->Time()), Warned(false), bursting(false), UserCount(ServerInstance->Users->local_users.size())
+ , age(ServerInstance->Time()), Warned(false), bursting(false), UserCount(ServerInstance->Users.GetLocalUsers().size())
, OperCount(0), rtt(0), StartBurst(0), Hidden(false)
{
AddHashEntry();
diff --git a/src/xline.cpp b/src/xline.cpp
index 62afcc285..3eb556234 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -155,7 +155,8 @@ void XLineManager::CheckELines()
if (ELines.empty())
return;
- for (UserManager::LocalList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator u2 = list.begin(); u2 != list.end(); u2++)
{
LocalUser* u = *u2;
@@ -325,7 +326,8 @@ bool XLineManager::DelLine(const char* hostmask, const std::string &type, User*
void ELine::Unset()
{
/* remove exempt from everyone and force recheck after deleting eline */
- for (UserManager::LocalList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator u2 = list.begin(); u2 != list.end(); u2++)
{
LocalUser* u = *u2;
u->exempt = false;
@@ -429,8 +431,8 @@ void XLineManager::ExpireLine(ContainerIter container, LookupIter item)
// applies lines, removing clients and changing nicks etc as applicable
void XLineManager::ApplyLines()
{
- UserManager::LocalList& list = ServerInstance->Users->local_users;
- for (UserManager::LocalList::iterator j = list.begin(); j != list.end(); ++j)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator j = list.begin(); j != list.end(); ++j)
{
LocalUser* u = *j;
@@ -679,7 +681,8 @@ bool GLine::Matches(const std::string &str)
void ELine::OnAdd()
{
/* When adding one eline, only check the one eline */
- for (UserManager::LocalList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator u2 = list.begin(); u2 != list.end(); u2++)
{
LocalUser* u = *u2;
if (this->Matches(u))