diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-09 16:35:24 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-09 16:35:24 +0000 |
commit | 1cbf29e3cd070c12437a657b47fc433008b2c74d (patch) | |
tree | 22b7a435ffd8bfa7dd97f2457b73df564753eddc /src/modules/m_spanningtree.cpp | |
parent | 89749a74402913d50bd5a9140757a383d6ff175e (diff) |
Move clientlist and chanlist into InspIRCd*
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4818 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree.cpp')
-rw-r--r-- | src/modules/m_spanningtree.cpp | 55 |
1 files changed, 23 insertions, 32 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 448e3470b..d0d7389de 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -90,10 +90,6 @@ extern int MODCOUNT; */ enum ServerState { LISTENER, CONNECTING, WAIT_AUTH_1, WAIT_AUTH_2, CONNECTED }; -/* We need to import these from the core for use in netbursts */ -extern user_hash clientlist; -extern chan_hash chanlist; - /* Foward declarations */ class TreeServer; class TreeSocket; @@ -317,7 +313,7 @@ class TreeServer : public classbase log(DEBUG,"Removing all users from server %s",this->ServerName.c_str()); const char* reason_s = reason.c_str(); std::vector<userrec*> time_to_die; - for (user_hash::iterator n = clientlist.begin(); n != clientlist.end(); n++) + for (user_hash::iterator n = ServerInstance->clientlist.begin(); n != ServerInstance->clientlist.end(); n++) { if (!strcmp(n->second->server, this->ServerName.c_str())) { @@ -1548,9 +1544,9 @@ class TreeSocket : public InspSocket const char* tempnick = params[1].c_str(); log(DEBUG,"Introduce client %s!%s@%s",tempnick,params[4].c_str(),params[2].c_str()); - user_hash::iterator iter = clientlist.find(tempnick); + user_hash::iterator iter = this->Instance->clientlist.find(tempnick); - if (iter != clientlist.end()) + if (iter != this->Instance->clientlist.end()) { // nick collision log(DEBUG,"Nick collision on %s!%s@%s: %lu %lu",tempnick,params[4].c_str(),params[2].c_str(),(unsigned long)age,(unsigned long)iter->second->age); @@ -1558,28 +1554,27 @@ class TreeSocket : public InspSocket return true; } - clientlist[tempnick] = new userrec(); - clientlist[tempnick]->fd = FD_MAGIC_NUMBER; - strlcpy(clientlist[tempnick]->nick, tempnick,NICKMAX-1); - strlcpy(clientlist[tempnick]->host, params[2].c_str(),63); - strlcpy(clientlist[tempnick]->dhost, params[3].c_str(),63); - clientlist[tempnick]->server = FindServerNamePtr(source.c_str()); - strlcpy(clientlist[tempnick]->ident, params[4].c_str(),IDENTMAX); - strlcpy(clientlist[tempnick]->fullname, params[7].c_str(),MAXGECOS); - clientlist[tempnick]->registered = REG_ALL; - clientlist[tempnick]->signon = age; + userrec* _new = new userrec(); + this->Instance->clientlist[tempnick] = _new; + _new->fd = FD_MAGIC_NUMBER; + strlcpy(_new->nick, tempnick,NICKMAX-1); + strlcpy(_new->host, params[2].c_str(),63); + strlcpy(_new->dhost, params[3].c_str(),63); + _new->server = this->Instance->FindServerNamePtr(source.c_str()); + strlcpy(_new->ident, params[4].c_str(),IDENTMAX); + strlcpy(_new->fullname, params[7].c_str(),MAXGECOS); + _new->registered = REG_ALL; + _new->signon = age; for (std::string::iterator v = params[5].begin(); v != params[5].end(); v++) - { - clientlist[tempnick]->modes[(*v)-65] = 1; - } + _new->modes[(*v)-65] = 1; if (params[6].find_first_of(":") != std::string::npos) - clientlist[tempnick]->SetSockAddr(AF_INET6, params[6].c_str(), 0); + _new->SetSockAddr(AF_INET6, params[6].c_str(), 0); else - clientlist[tempnick]->SetSockAddr(AF_INET, params[6].c_str(), 0); + _new->SetSockAddr(AF_INET, params[6].c_str(), 0); - WriteOpers("*** Client connecting at %s: %s!%s@%s [%s]",clientlist[tempnick]->server,clientlist[tempnick]->nick,clientlist[tempnick]->ident,clientlist[tempnick]->host, clientlist[tempnick]->GetIPString()); + WriteOpers("*** Client connecting at %s: %s!%s@%s [%s]",_new->server,_new->nick,_new->ident,_new->host, _new->GetIPString()); params[7] = ":" + params[7]; DoOneToAllButSender(source,"NICK",params,source); @@ -1588,7 +1583,7 @@ class TreeSocket : public InspSocket TreeServer* SourceServer = FindServer(source); if (SourceServer) { - log(DEBUG,"Found source server of %s",clientlist[tempnick]->nick); + log(DEBUG,"Found source server of %s",_new->nick); SourceServer->AddUserCount(); } @@ -1756,7 +1751,7 @@ class TreeSocket : public InspSocket int iterations = 0; std::string n = Srv->GetServerName(); const char* sn = n.c_str(); - for (chan_hash::iterator c = chanlist.begin(); c != chanlist.end(); c++, iterations++) + for (chan_hash::iterator c = this->Instance->chanlist.begin(); c != this->Instance->chanlist.end(); c++, iterations++) { SendFJoins(Current, c->second); if (*c->second->topic) @@ -1780,7 +1775,7 @@ class TreeSocket : public InspSocket char data[MAXBUF]; std::deque<std::string> list; int iterations = 0; - for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++, iterations++) + for (user_hash::iterator u = this->Instance->clientlist.begin(); u != this->Instance->clientlist.end(); u++, iterations++) { if (u->second->registered == REG_ALL) { @@ -1812,10 +1807,6 @@ class TreeSocket : public InspSocket */ void DoBurst(TreeServer* s) { - /* The calls here to ServerInstance-> yield the processing - * back to the core so that a large burst is split into at least 6 sections - * (possibly more) - */ std::string burst = "BURST "+ConvToStr(time(NULL)); std::string endburst = "ENDBURST"; // Because by the end of the netburst, it could be gone! @@ -3539,13 +3530,13 @@ class ModuleSpanningTree : public Module float percent; char text[80]; - if (clientlist.size() == 0) { + if (ServerInstance->clientlist.size() == 0) { // If there are no users, WHO THE HELL DID THE /MAP?!?!?! percent = 0; } else { - percent = ((float)Current->GetUserCount() / (float)clientlist.size()) * 100; + percent = ((float)Current->GetUserCount() / (float)ServerInstance->clientlist.size()) * 100; } snprintf(text, 80, "%s %s%5d [%5.2f%%]", Current->GetName().c_str(), spacer, Current->GetUserCount(), percent); totusers += Current->GetUserCount(); |