mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Add a typedef for LocalUserList
This commit is contained in:
parent
83db3dc06a
commit
a589577b68
@ -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;
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -20,10 +20,9 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "inspircd_config.h"
|
||||
#include "inspircd.h"
|
||||
#include "base.h"
|
||||
#include <time.h>
|
||||
#include "inspircd.h"
|
||||
#include <typeinfo>
|
||||
|
||||
classbase::classbase()
|
||||
|
@ -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++)
|
||||
|
@ -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));
|
||||
|
@ -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'))
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
|
@ -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)))
|
||||
|
@ -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");
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user