summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-11-21 00:15:13 +0100
committerattilamolnar <attilamolnar@hush.com>2012-11-29 23:41:22 +0100
commita589577b68cb84bc877ecdd4c0f9cb84a1581ddd (patch)
tree37a4f52f9bcac855d7fa2198f991a2fc919ea738
parent83db3dc06a44b50d8e25828e201a51edb4030d92 (diff)
Add a typedef for LocalUserList
-rw-r--r--include/typedefs.h4
-rw-r--r--include/usermanager.h2
-rw-r--r--src/base.cpp3
-rw-r--r--src/commands/cmd_modenotice.cpp2
-rw-r--r--src/commands/cmd_stats.cpp4
-rw-r--r--src/commands/cmd_wallops.cpp2
-rw-r--r--src/helperfuncs.cpp2
-rw-r--r--src/inspircd.cpp4
-rw-r--r--src/modules/extra/m_geoip.cpp2
-rw-r--r--src/modules/m_close.cpp5
-rw-r--r--src/modules/m_jumpserver.cpp2
-rw-r--r--src/modules/m_nationalchars.cpp2
-rw-r--r--src/usermanager.cpp4
-rw-r--r--src/userprocess.cpp2
-rw-r--r--src/users.cpp4
-rw-r--r--src/xline.cpp8
16 files changed, 27 insertions, 25 deletions
diff --git a/include/typedefs.h b/include/typedefs.h
index da2775152..250bec5c9 100644
--- a/include/typedefs.h
+++ b/include/typedefs.h
@@ -64,6 +64,10 @@ struct ResourceRecord;
typedef nspace::hash_map<std::string, Channel*, nspace::hash<std::string>, irc::StrHashComp> chan_hash;
#endif
+/** A list holding local users, this is the type of UserManager::local_users
+ */
+typedef std::vector<LocalUser*> LocalUserList;
+
/** A list of failed port bindings, used for informational purposes on startup */
typedef std::vector<std::pair<std::string, std::string> > FailedPortList;
diff --git a/include/usermanager.h b/include/usermanager.h
index 92b40b373..be6c6b6bb 100644
--- a/include/usermanager.h
+++ b/include/usermanager.h
@@ -54,7 +54,7 @@ class CoreExport UserManager
/** Local client list, a vector containing only local clients
*/
- std::vector<LocalUser*> local_users;
+ LocalUserList local_users;
/** Oper list, a vector containing all local and remote opered users
*/
diff --git a/src/base.cpp b/src/base.cpp
index 39a4a86bf..bf74d9dc2 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -20,10 +20,9 @@
*/
-#include "inspircd_config.h"
+#include "inspircd.h"
#include "base.h"
#include <time.h>
-#include "inspircd.h"
#include <typeinfo>
classbase::classbase()
diff --git a/src/commands/cmd_modenotice.cpp b/src/commands/cmd_modenotice.cpp
index c962a4d11..852b72f6a 100644
--- a/src/commands/cmd_modenotice.cpp
+++ b/src/commands/cmd_modenotice.cpp
@@ -31,7 +31,7 @@ class CommandModeNotice : public Command
CmdResult Handle(const std::vector<std::string>& parameters, User *src)
{
int mlen = parameters[0].length();
- for (std::vector<LocalUser*>::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++)
+ for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++)
{
User* user = *i;
for (int n = 0; n < mlen; n++)
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp
index 1d3130bd4..9a5bfc52d 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -364,7 +364,7 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
/* stats l (show user I/O stats) */
case 'l':
results.push_back(sn+" 211 "+user->nick+" :nick[ident@host] sendq cmds_out bytes_out cmds_in bytes_in time_open");
- for (std::vector<LocalUser*>::iterator n = ServerInstance->Users->local_users.begin(); n != ServerInstance->Users->local_users.end(); n++)
+ for (LocalUserList::iterator n = ServerInstance->Users->local_users.begin(); n != ServerInstance->Users->local_users.end(); n++)
{
LocalUser* i = *n;
results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->dhost+"] "+ConvToStr(i->eh.getSendQSize())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(ServerInstance->Time() - i->age));
@@ -374,7 +374,7 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
/* stats L (show user I/O stats with IP addresses) */
case 'L':
results.push_back(sn+" 211 "+user->nick+" :nick[ident@ip] sendq cmds_out bytes_out cmds_in bytes_in time_open");
- for (std::vector<LocalUser*>::iterator n = ServerInstance->Users->local_users.begin(); n != ServerInstance->Users->local_users.end(); n++)
+ for (LocalUserList::iterator n = ServerInstance->Users->local_users.begin(); n != ServerInstance->Users->local_users.end(); n++)
{
LocalUser* i = *n;
results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->GetIPString()+"] "+ConvToStr(i->eh.getSendQSize())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(ServerInstance->Time() - i->age));
diff --git a/src/commands/cmd_wallops.cpp b/src/commands/cmd_wallops.cpp
index 0effa3c5a..198997a95 100644
--- a/src/commands/cmd_wallops.cpp
+++ b/src/commands/cmd_wallops.cpp
@@ -45,7 +45,7 @@ CmdResult CommandWallops::Handle (const std::vector<std::string>& parameters, Us
std::string wallop("WALLOPS :");
wallop.append(parameters[0]);
- for (std::vector<LocalUser*>::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++)
+ for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++)
{
User* t = *i;
if (t->IsModeSet('w'))
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 3795e6398..668cb95ec 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -140,7 +140,7 @@ 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 (std::vector<LocalUser*>::const_iterator i = this->Users->local_users.begin(); i != this->Users->local_users.end(); i++)
+ for (LocalUserList::const_iterator i = this->Users->local_users.begin(); i != this->Users->local_users.end(); i++)
{
User* u = *i;
if (u->registered == REG_ALL)
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index cb50595d2..0a3bc1820 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -119,7 +119,7 @@ void InspIRCd::Cleanup()
ports.clear();
/* Close all client sockets, or the new process inherits them */
- std::vector<LocalUser*>::reverse_iterator i = Users->local_users.rbegin();
+ LocalUserList::reverse_iterator i = Users->local_users.rbegin();
while (i != this->Users->local_users.rend())
{
User* u = *i++;
@@ -219,7 +219,7 @@ void InspIRCd::RehashUsersAndChans()
// Reset the already_sent IDs so we don't wrap it around and drop a message
LocalUser::already_sent_id = 0;
- for (std::vector<LocalUser*>::const_iterator i = Users->local_users.begin(); i != Users->local_users.end(); i++)
+ for (LocalUserList::const_iterator i = Users->local_users.begin(); i != Users->local_users.end(); i++)
{
(**i).already_sent = 0;
(**i).RemoveExpiredInvites();
diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp
index ffb4c1922..f92054f9e 100644
--- a/src/modules/extra/m_geoip.cpp
+++ b/src/modules/extra/m_geoip.cpp
@@ -60,7 +60,7 @@ class ModuleGeoIP : public Module
Implementation eventlist[] = { I_OnSetConnectClass, I_OnStats };
ServerInstance->Modules->Attach(eventlist, this, 2);
- for (std::vector<LocalUser*>::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
+ for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
{
LocalUser* user = *i;
if ((user->registered == REG_ALL) && (!ext.get(user)))
diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp
index ec02b6464..5a6e7e963 100644
--- a/src/modules/m_close.cpp
+++ b/src/modules/m_close.cpp
@@ -36,10 +36,9 @@ class CommandClose : public Command
{
std::map<std::string,int> closed;
- std::vector<LocalUser*>::reverse_iterator u = ServerInstance->Users->local_users.rbegin();
- while (u != ServerInstance->Users->local_users.rend())
+ for (LocalUserList::const_iterator u = ServerInstance->Users->local_users.begin(); u != ServerInstance->Users->local_users.end(); ++u)
{
- LocalUser* user = *u++;
+ LocalUser* user = *u;
if (user->registered != REG_ALL)
{
ServerInstance->Users->QuitUser(user, "Closing all unknown connections per request");
diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp
index 2d304ab74..ac3add29b 100644
--- a/src/modules/m_jumpserver.cpp
+++ b/src/modules/m_jumpserver.cpp
@@ -99,7 +99,7 @@ class CommandJumpserver : public Command
if (redirect_all_immediately)
{
/* Redirect everyone but the oper sending the command */
- for (std::vector<LocalUser*>::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++)
+ for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
{
User* t = *i;
if (!IS_OPER(t))
diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp
index c59c1ba2a..587eaf56d 100644
--- a/src/modules/m_nationalchars.cpp
+++ b/src/modules/m_nationalchars.cpp
@@ -268,7 +268,7 @@ class ModuleNationalChars : public Module
if (!forcequit)
return;
- for (std::vector<LocalUser*>::iterator iter = ServerInstance->Users->local_users.begin(); iter != ServerInstance->Users->local_users.end(); ++iter)
+ for (LocalUserList::const_iterator iter = ServerInstance->Users->local_users.begin(); iter != ServerInstance->Users->local_users.end(); ++iter)
{
/* Fix by Brain: Dont quit UID users */
User* n = *iter;
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index b6a33d2c4..279b1d3ec 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -346,7 +346,7 @@ void UserManager::ServerNoticeAll(const char* text, ...)
snprintf(formatbuffer,MAXBUF,"NOTICE $%s :%s", ServerInstance->Config->ServerName.c_str(), textbuffer);
- for (std::vector<LocalUser*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
+ for (LocalUserList::const_iterator i = local_users.begin(); i != local_users.end(); i++)
{
User* t = *i;
t->WriteServ(std::string(formatbuffer));
@@ -367,7 +367,7 @@ void UserManager::ServerPrivmsgAll(const char* text, ...)
snprintf(formatbuffer,MAXBUF,"PRIVMSG $%s :%s", ServerInstance->Config->ServerName.c_str(), textbuffer);
- for (std::vector<LocalUser*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
+ for (LocalUserList::const_iterator i = local_users.begin(); i != local_users.end(); i++)
{
User* t = *i;
t->WriteServ(std::string(formatbuffer));
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index 72cee8f1e..9cc2e7df7 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -56,7 +56,7 @@ void InspIRCd::DoBackgroundUserStuff()
/*
* loop over all local users..
*/
- std::vector<LocalUser*>::reverse_iterator count2 = this->Users->local_users.rbegin();
+ LocalUserList::reverse_iterator count2 = this->Users->local_users.rbegin();
while (count2 != this->Users->local_users.rend())
{
LocalUser *curr = *count2;
diff --git a/src/users.cpp b/src/users.cpp
index 92276d07c..7cfbdbc0c 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -539,7 +539,7 @@ CullResult User::cull()
CullResult LocalUser::cull()
{
- std::vector<LocalUser*>::iterator x = find(ServerInstance->Users->local_users.begin(),ServerInstance->Users->local_users.end(),this);
+ LocalUserList::iterator x = find(ServerInstance->Users->local_users.begin(),ServerInstance->Users->local_users.end(),this);
if (x != ServerInstance->Users->local_users.end())
ServerInstance->Users->local_users.erase(x);
else
@@ -1504,7 +1504,7 @@ void User::SendAll(const char* command, const char* text, ...)
snprintf(formatbuffer,MAXBUF,":%s %s $* :%s", this->GetFullHost().c_str(), command, textbuffer);
std::string fmt = formatbuffer;
- for (std::vector<LocalUser*>::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++)
+ for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++)
{
if ((*i)->registered == REG_ALL)
(*i)->Write(fmt);
diff --git a/src/xline.cpp b/src/xline.cpp
index 12948959b..6501a7f6d 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -156,7 +156,7 @@ void XLineManager::CheckELines()
if (ELines.empty())
return;
- for (std::vector<LocalUser*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+ for (LocalUserList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
{
User* u = (User*)(*u2);
@@ -321,7 +321,7 @@ 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 (std::vector<LocalUser*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+ for (LocalUserList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
{
User* u = (User*)(*u2);
u->exempt = false;
@@ -425,7 +425,7 @@ void XLineManager::ExpireLine(ContainerIter container, LookupIter item)
// applies lines, removing clients and changing nicks etc as applicable
void XLineManager::ApplyLines()
{
- std::vector<LocalUser*>::reverse_iterator u2 = ServerInstance->Users->local_users.rbegin();
+ LocalUserList::reverse_iterator u2 = ServerInstance->Users->local_users.rbegin();
while (u2 != ServerInstance->Users->local_users.rend())
{
User* u = *u2++;
@@ -674,7 +674,7 @@ bool GLine::Matches(const std::string &str)
void ELine::OnAdd()
{
/* When adding one eline, only check the one eline */
- for (std::vector<LocalUser*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+ for (LocalUserList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
{
User* u = (User*)(*u2);
if (this->Matches(u))