1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 23:13:12 +02:00

Fixed compile

This commit is contained in:
Adam
2011-03-14 20:16:38 -04:00
parent 2555d0d637
commit ddfb16de1a
32 changed files with 122 additions and 158 deletions
+3
View File
@@ -20,6 +20,9 @@ class Message;
namespace Anope
{
template<typename T> class map : public std::map<string, T> { };
template<typename T> class insensitive_map : public std::map<string, T, std::less<ci::string> > { };
/**
* A wrapper string class around all the other string classes, this class will
* allow us to only require one type of string everywhere that can be converted
+2 -2
View File
@@ -12,8 +12,8 @@
class BotInfo;
extern CoreExport patricia_tree<BotInfo *, ci::ci_char_traits> BotListByNick;
extern CoreExport patricia_tree<BotInfo *> BotListByUID;
extern CoreExport Anope::insensitive_map<BotInfo *> BotListByNick;
extern CoreExport Anope::map<BotInfo *> BotListByUID;
/** Flags settable on a bot
*/
-23
View File
@@ -162,12 +162,6 @@ namespace irc
* @return Pointer to the first occurance of c in s1
*/
static const char *find(const char *s1, int n, char c);
/** Convert a char to lowercase
* @param c1 The character to convert
* @return The lowercase version of the char
*/
static const char chartolower(char c1);
};
/** This typedef declares irc::string based upon irc_char_traits.
@@ -239,12 +233,6 @@ namespace ci
* @return Pointer to the first occurance of c in s1
*/
static const char *find(const char *s1, int n, char c);
/** Convert a char to lowercase
* @param c1 The character to convert
* @return The lowercase version of the char
*/
static const char chartolower(char c1);
};
/** This typedef declares ci::string based upon ci_char_traits.
@@ -271,17 +259,6 @@ namespace ci
namespace std
{
/** The std_char_traits class is used for normal comparison of strings.
*/
struct CoreExport std_char_traits : char_traits<char>
{
/** Convert a char to lowercase
* @param c1 The character to convert
* @return The lowercase version of the char
*/
static const char chartolower(char c1);
};
/** An overload for std::equal_to<ci::string> that uses Anope::string, passed for the fourth temmplate
* argument for unordered_map
*/
+1 -2
View File
@@ -202,7 +202,6 @@ extern "C" void __pfnBkCheck() {}
#include <set>
#include "anope.h"
#include "patricia.h"
/** This class can be used on its own to represent an exception, or derived to represent a module-specific exception.
* When a module whishes to abort, e.g. within a constructor, it should throw an exception using ModuleException or
@@ -897,7 +896,7 @@ struct Exception
/*************************************************************************/
extern CoreExport patricia_tree<Session *> SessionList;
extern CoreExport Anope::map<Session *> SessionList;
struct Session
{
+2 -2
View File
@@ -8,8 +8,8 @@
#ifndef USERS_H
#define USERS_H
extern CoreExport patricia_tree<User *, ci::ci_char_traits> UserListByNick;
extern CoreExport patricia_tree<User *> UserListByUID;
extern CoreExport Anope::insensitive_map<User *> UserListByNick;
extern CoreExport Anope::map<User *> UserListByUID;
class CoreExport ChannelStatus : public Flags<ChannelModeName, CMODE_END * 2>
{
+4 -4
View File
@@ -26,9 +26,9 @@ class CommandBSBotList : public Command
User *u = source.u;
unsigned count = 0;
for (patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick); it.next();)
for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
{
BotInfo *bi = *it;
BotInfo *bi = it->second;
if (!bi->HasFlag(BI_PRIVATE))
{
@@ -43,9 +43,9 @@ class CommandBSBotList : public Command
{
source.Reply(_("Bots reserved to IRC operators:"));
for (patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick); it.next();)
for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
{
BotInfo *bi = *it;
BotInfo *bi = it->second;
if (bi->HasFlag(BI_PRIVATE))
{
+2 -2
View File
@@ -213,9 +213,9 @@ class CommandCSAKick : public Command
{
/* Match against all currently online users with equal or
* higher access. - Viper */
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it)
{
User *u2 = *it;
User *u2 = it->second;
ChanAccess *u2_access = ci->GetAccess(nc), *u_access = ci->GetAccess(u);
int16 u2_level = u2_access ? u2_access->level : 0, u_level = u_access ? u_access->level : 0;
+2 -2
View File
@@ -782,9 +782,9 @@ class DBPlain : public Module
FOREACH_MOD(I_OnDatabaseWriteMetadata, OnDatabaseWriteMetadata(WriteMetadata, na));
}
for (patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick); it.next();)
for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
{
BotInfo *bi = *it;
BotInfo *bi = it->second;
db_buffer << "BI " << bi->nick << " " << bi->GetIdent() << " " << bi->host << " " << bi->created << " " << bi->chancount << " :" << bi->realname << endl;
if (bi->FlagCount())
+2 -2
View File
@@ -176,8 +176,8 @@ class CommandOSAKill : public Command
if (user)
mask = "*@" + user->host;
unsigned int affected = 0;
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
if (Anope::Match((*it)->GetIdent() + "@" + (*it)->host, mask))
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
if (Anope::Match(it->second->GetIdent() + "@" + it->second->host, mask))
++affected;
float percent = static_cast<float>(affected) / static_cast<float>(UserListByNick.size()) * 100.0;
+3 -4
View File
@@ -39,11 +39,10 @@ class CommandOSNOOP : public Command
source.Reply(_("All O:lines of \002%s\002 have been removed."), server.c_str());
/* Kill all the IRCops of the server */
patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick);
for (bool next = it.next(); next;)
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end();)
{
User *u2 = *it;
next = it.next();
User *u2 = it->second;
++it;
if (u2 && u2->HasMode(UMODE_OPER) && Anope::Match(u2->server->GetName(), server, true))
kill_user(Config->s_OperServ, u2, reason);
+2 -2
View File
@@ -139,9 +139,9 @@ class CommandOSSession : public Command
source.Reply(_("Hosts with at least \002%d\002 sessions:"), mincount);
source.Reply(_("Sessions Host"));
for (patricia_tree<Session *>::iterator it(SessionList); it.next();)
for (Anope::map<Session *>::iterator it = SessionList.begin(), it_end = SessionList.end(); it != it_end; ++it)
{
Session *session = *it;
Session *session = it->second;
if (session->count >= mincount)
source.Reply(_("%6d %s"), session->count, session->host.c_str());
+2 -2
View File
@@ -190,8 +190,8 @@ class CommandOSSNLine : public Command
if (mask[masklen - 1] == ' ')
mask.erase(masklen - 1);
unsigned int affected = 0;
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
if (Anope::Match((*it)->realname, mask))
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
if (Anope::Match(it->second->realname, mask))
++affected;
float percent = static_cast<float>(affected) / static_cast<float>(UserListByNick.size()) * 100.0;
+2 -2
View File
@@ -171,8 +171,8 @@ class CommandOSSQLine : public Command
if (!mask.empty() && !reason.empty())
{
unsigned int affected = 0;
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
if (Anope::Match((*it)->nick, mask))
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
if (Anope::Match(it->second->nick, mask))
++affected;
float percent = static_cast<float>(affected) / static_cast<float>(UserListByNick.size()) * 100.0;
+2 -2
View File
@@ -174,8 +174,8 @@ class CommandOSSZLine : public Command
if (user && user->ip())
mask = user->ip.addr();
unsigned int affected = 0;
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
if ((*it)->ip() && Anope::Match((*it)->ip.addr(), mask))
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
if (it->second->ip() && Anope::Match(it->second->ip.addr(), mask))
++affected;
float percent = static_cast<float>(affected) / static_cast<float>(UserListByNick.size()) * 100.0;
+2 -2
View File
@@ -53,9 +53,9 @@ class CommandOSUserList : public Command
source.Reply(_("Users list:\n"
"Nick Mask"));
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
User *u2 = *it;
User *u2 = it->second;
if (!pattern.empty())
{
+4 -4
View File
@@ -640,9 +640,9 @@ class DBMySQL : public Module
FOREACH_MOD(I_OnDatabaseWriteMetadata, OnDatabaseWriteMetadata(WriteChannelMetadata, CurChannel));
}
for (patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick); it.next();)
for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
{
CurBot = *it;
CurBot = it->second;
FOREACH_MOD(I_OnDatabaseWriteMetadata, OnDatabaseWriteMetadata(WriteBotMetadata, CurBot));
/* This is for the core bots, bots added by users are already handled by an event */
@@ -1222,8 +1222,8 @@ static void SaveDatabases()
me->RunQuery("TRUNCATE TABLE `anope_bs_core`");
for (patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick); it.next();)
me->OnBotCreate(*it);
for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
me->OnBotCreate(it->second);
me->RunQuery("TRUNCATE TABLE `anope_cs_info`");
me->RunQuery("TRUNCATE TABLE `anope_bs_badwords`");
+2 -2
View File
@@ -768,9 +768,9 @@ class ProtoInspIRCd : public Module
void OnServerSync(Server *s)
{
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
User *u = *it;
User *u = it->second;
if (u->server == s && !u->IsIdentified())
validate_user(u);
}
+2 -2
View File
@@ -759,9 +759,9 @@ class ProtoInspIRCd : public Module
void OnServerSync(Server *s)
{
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
User *u = *it;
User *u = it->second;
if (u->server == s && !u->IsIdentified())
validate_user(u);
}
+6 -2
View File
@@ -46,9 +46,13 @@ class ngIRCdProto : public IRCDProto
void SendAkill(User *u, const XLine *x)
{
if (SGLine && u == NULL)
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
if (SGLine->Check(*it) != NULL)
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end();)
{
u = it->second;
++it;
if (SGLine->Check(u) != NULL)
break;
}
}
void SendAkillDel(const XLine*) { }
+2 -2
View File
@@ -644,9 +644,9 @@ class ProtoPlexus : public Module
void OnServerSync(Server *s)
{
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
User *u = *it;
User *u = it->second;
if (u->server == s && !u->IsIdentified())
validate_user(u);
}
+2 -2
View File
@@ -579,9 +579,9 @@ class ProtoRatbox : public Module
void OnServerSync(Server *s)
{
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
User *u = *it;
User *u = it->second;
if (u->server == s && !u->IsIdentified())
validate_user(u);
}
+6 -6
View File
@@ -9,8 +9,8 @@
#include "modules.h"
#include "commands.h"
patricia_tree<BotInfo *, ci::ci_char_traits> BotListByNick;
patricia_tree<BotInfo *> BotListByUID;
Anope::insensitive_map<BotInfo *> BotListByNick;
Anope::map<BotInfo *> BotListByUID;
BotInfo *BotServ = NULL;
BotInfo *ChanServ = NULL;
@@ -46,9 +46,9 @@ BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const A
else
this->UnsetFlag(BI_CORE);
BotListByNick.insert(this->nick, this);
BotListByNick[this->nick] = this;
if (!this->uid.empty())
BotListByUID.insert(this->uid, this);
BotListByUID[this->uid] = this;
// If we're synchronised with the uplink already, send the bot.
if (Me && Me->IsSynced())
@@ -118,8 +118,8 @@ void BotInfo::SetNewNick(const Anope::string &newnick)
this->nick = newnick;
UserListByNick.insert(this->nick, this);
BotListByNick.insert(this->nick, this);
UserListByNick[this->nick] = this;
BotListByNick[this->nick] = this;
}
void BotInfo::RejoinAll()
+13 -5
View File
@@ -34,9 +34,9 @@ void get_botserv_stats(long *nrec, long *memuse)
{
long count = 0, mem = 0;
for (patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick); it.next();)
for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
{
BotInfo *bi = *it;
BotInfo *bi = it->second;
++count;
mem += sizeof(*bi);
@@ -361,11 +361,19 @@ void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf)
BotInfo *findbot(const Anope::string &nick)
{
BotInfo *bi;
BotInfo *bi = NULL;
if (isdigit(nick[0]) && ircd->ts6)
bi = BotListByUID.find(nick);
{
Anope::map<BotInfo *>::iterator it = BotListByUID.find(nick);
if (it != BotListByUID.end())
bi = it->second;
}
else
bi = BotListByNick.find(nick);
{
Anope::insensitive_map<BotInfo *>::iterator it = BotListByNick.find(nick);
if (it != BotListByNick.end())
bi = it->second;
}
FOREACH_MOD(I_OnFindBot, OnFindBot(nick));
-15
View File
@@ -87,11 +87,6 @@ const char *irc::irc_char_traits::find(const char *s1, int n, char c)
return n >= 0 ? s1 : NULL;
}
const char irc::irc_char_traits::chartolower(char c1)
{
return rfc_case_insensitive_map[static_cast<unsigned char>(c1)];
}
/* VS 2008 specific function */
bool irc::hash::operator()(const Anope::string &s1, const Anope::string &s2) const
{
@@ -158,11 +153,6 @@ const char *ci::ci_char_traits::find(const char *s1, int n, char c)
return n >= 0 ? s1 : NULL;
}
const char ci::ci_char_traits::chartolower(char c1)
{
return ascii_case_insensitive_map[static_cast<unsigned char>(c1)];
}
/* VS 2008 specific function */
bool ci::hash::operator()(const Anope::string &s1, const Anope::string &s2) const
{
@@ -188,11 +178,6 @@ size_t ci::hash::operator()(const Anope::string &s) const
return operator()(s.ci_str());
}
const char std::std_char_traits::chartolower(char c1)
{
return c1;
}
/** Compare two Anope::strings as ci::strings
* @param s1 The first string
* @param s2 The second string
+2 -2
View File
@@ -57,9 +57,9 @@ void introduce_user(const Anope::string &user)
}
/* We make the bots go online */
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it)
{
User *u = *it;
User *u = it->second;
ircdproto->SendClientIntroduction(u, ircd->pseudoclient_mode);
+2 -2
View File
@@ -32,9 +32,9 @@ void InitLogChannels(ServerConfig *config)
c->SetFlag(CH_LOGCHAN);
c->SetFlag(CH_PERSIST);
for (patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick); it.next();)
for (Anope::insensitive_map<BotInfo *>::iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
{
BotInfo *bi = *it;
BotInfo *bi = it->second;
if (bi->HasFlag(BI_CORE) && !c->FindUser(bi))
bi->Join(c, &config->BotModeList);
+11 -17
View File
@@ -170,11 +170,9 @@ void do_restart_services()
if (quitmsg.empty())
quitmsg = "Restarting";
/* Send a quit for all of our bots */
patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick);
for (bool next = it.next(); next;)
for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
{
BotInfo *bi = *it;
next = it.next();
BotInfo *bi = it->second;
/* Don't use quitmsg here, it may contain information you don't want people to see */
ircdproto->SendQuit(bi, "Restarting");
@@ -214,11 +212,9 @@ static void services_shutdown()
if (started && UplinkSock)
{
/* Send a quit for all of our bots */
patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick);
for (bool next = it.next(); next;)
for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
{
BotInfo *bi = *it;
next = it.next();
BotInfo *bi = it->second;
/* Don't use quitmsg here, it may contain information you don't want people to see */
ircdproto->SendQuit(bi, "Shutting down");
@@ -230,11 +226,10 @@ static void services_shutdown()
ircdproto->SendSquit(Config->ServerName, quitmsg);
patricia_tree<User *, ci::ci_char_traits>::iterator uit(UserListByNick);
for (bool next = uit.next(); next;)
for (Anope::insensitive_map<User *>::const_iterator it = UserListByNick.begin(); it != UserListByNick.end();)
{
User *u = *uit;
next = uit.next();
User *u = it->second;
++it;
delete u;
}
}
@@ -505,11 +500,10 @@ int main(int ac, char **av, char **envp)
FOREACH_MOD(I_OnServerDisconnect, OnServerDisconnect());
/* Clear all of our users, but not our bots */
patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick);
for (bool next = it.next(); next;)
for (Anope::insensitive_map<User *>::const_iterator it = UserListByNick.begin(); it != UserListByNick.end();)
{
User *u = *it;
next = it.next();
User *u = it->second;
++it;
if (u->server != Me)
delete u;
@@ -551,4 +545,4 @@ int main(int ac, char **av, char **envp)
}
return 0;
}
}
+3 -17
View File
@@ -501,23 +501,9 @@ bool nickIsServices(const Anope::string &tempnick, bool bot)
nick = nick.substr(0, at);
}
if (!Config->s_NickServ.empty() && nick.equals_ci(Config->s_NickServ))
return true;
else if (!Config->s_ChanServ.empty() && nick.equals_ci(Config->s_ChanServ))
return true;
else if (!Config->s_HostServ.empty() && nick.equals_ci(Config->s_HostServ))
return true;
else if (!Config->s_MemoServ.empty() && nick.equals_ci(Config->s_MemoServ))
return true;
else if (!Config->s_BotServ.empty() && nick.equals_ci(Config->s_BotServ))
return true;
else if (!Config->s_OperServ.empty() && nick.equals_ci(Config->s_OperServ))
return true;
else if (!Config->s_GlobalNoticer.empty() && nick.equals_ci(Config->s_GlobalNoticer))
return true;
else if (!Config->s_BotServ.empty() && bot && BotListByNick.find(nick))
return true;
BotInfo *bi = findbot(nick);
if (bi)
return bot ? true : bi->HasFlag(BI_CORE);
return false;
}
+6 -8
View File
@@ -593,11 +593,10 @@ XLine *SNLineManager::Add(BotInfo *bi, User *u, const Anope::string &mask, time_
{
Anope::string rreason = "G-Lined: " + reason;
patricia_tree<User *, ci::ci_char_traits>::iterator uit(UserListByNick);
for (bool next = uit.next(); next;)
for (Anope::insensitive_map<User *>::const_iterator it = UserListByNick.begin(); it != UserListByNick.end();)
{
User *user = *uit;
next = uit.next();
User *user = it->second;
++it;
if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->realname, x->Mask))
kill_user(Config->ServerName, user, rreason);
@@ -727,11 +726,10 @@ XLine *SQLineManager::Add(BotInfo *bi, User *u, const Anope::string &mask, time_
}
else
{
patricia_tree<User *, ci::ci_char_traits>::iterator uit(UserListByNick);
for (bool next = uit.next(); next;)
for (Anope::insensitive_map<User *>::const_iterator it = UserListByNick.begin(); it != UserListByNick.end();)
{
User *user = *uit;
next = uit.next();
User *user = it->second;
++it;
if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->nick, x->Mask))
kill_user(Config->ServerName, user, rreason);
+3 -4
View File
@@ -65,11 +65,10 @@ Server::~Server()
if (Capab.HasFlag(CAPAB_NOQUIT) || Capab.HasFlag(CAPAB_QS))
{
patricia_tree<User *, ci::ci_char_traits>::iterator uit(UserListByNick);
for (bool next = uit.next(); next;)
for (Anope::insensitive_map<User *>::const_iterator it = UserListByNick.begin(); it != UserListByNick.end();)
{
User *u = *uit;
next = uit.next();
User *u = it->second;
++it;
if (u->server == this)
{
+8 -6
View File
@@ -40,7 +40,7 @@
/*************************************************************************/
patricia_tree<Session *> SessionList;
Anope::map<Session *> SessionList;
std::vector<Exception *> exceptions;
@@ -53,10 +53,9 @@ void get_session_stats(long &count, long &mem)
count = SessionList.size();
mem = sizeof(Session) * SessionList.size();
for (patricia_tree<Session *>::iterator it(SessionList); it.next();)
for (Anope::map<Session *>::iterator it = SessionList.begin(), it_end = SessionList.end(); it != it_end; ++it)
{
Session *session = *it;
Session *session = it->second;
mem += session->host.length() + 1;
}
}
@@ -84,7 +83,10 @@ void get_exception_stats(long &count, long &mem)
Session *findsession(const Anope::string &host)
{
return SessionList.find(host);
Anope::map<Session *>::iterator it = SessionList.find(host);
if (it != SessionList.end())
return it->second;
return NULL;
}
/* Attempt to add a host to the session list. If the addition of the new host
@@ -149,7 +151,7 @@ void add_session(User *u)
session->count = 1;
session->hits = 0;
SessionList.insert(session->host, session);
SessionList[session->host] = session;
}
}
+19 -9
View File
@@ -12,8 +12,8 @@
#include "services.h"
#include "modules.h"
patricia_tree<User *, ci::ci_char_traits> UserListByNick;
patricia_tree<User *> UserListByUID;
Anope::insensitive_map<User *> UserListByNick;
Anope::map<User *> UserListByUID;
int32 opcnt = 0;
uint32 usercnt = 0, maxusercnt = 0;
@@ -42,9 +42,9 @@ User::User(const Anope::string &snick, const Anope::string &sident, const Anope:
this->uid = suid;
this->isSuperAdmin = 0;
UserListByNick.insert(snick, this);
UserListByNick[snick] = this;
if (!suid.empty())
UserListByUID.insert(suid, this);
UserListByUID[suid] = this;
this->nc = NULL;
@@ -68,7 +68,7 @@ void User::SetNewNick(const Anope::string &newnick)
this->nick = newnick;
UserListByNick.insert(this->nick, this);
UserListByNick[this->nick] = this;
OnAccess = false;
NickAlias *na = findnick(this->nick);
@@ -761,9 +761,9 @@ void get_user_stats(long &count, long &mem)
{
count = mem = 0;
for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
for (Anope::insensitive_map<User *>::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
User *user = *it;
User *user = it->second;
++count;
mem += sizeof(*user);
@@ -784,9 +784,19 @@ void get_user_stats(long &count, long &mem)
User *finduser(const Anope::string &nick)
{
if (isdigit(nick[0]) && ircd->ts6)
return UserListByUID.find(nick);
{
Anope::map<User *>::iterator it = UserListByUID.find(nick);
if (it != UserListByUID.end())
return it->second;
}
else
{
Anope::insensitive_map<User *>::iterator it = UserListByNick.find(nick);
if (it != UserListByNick.end())
return it->second;
}
return UserListByNick.find(nick);
return NULL;
}
/*************************************************************************/