diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_check.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_httpd_stats.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_redirect.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 55 | ||||
-rw-r--r-- | src/modules/m_tline.cpp | 5 |
5 files changed, 33 insertions, 43 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 92b6d64f0..f697c4670 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -23,11 +23,11 @@ using namespace std; #include "commands.h" #include "inspircd.h" #include "helperfuncs.h" +#include "wildcard.h" /* $ModDesc: Provides the /check command to retrieve information on a user, channel, or IP address */ -extern user_hash clientlist; -extern bool match(const char *, const char *); +extern InspIRCd* ServerInstance; static Server *Srv; @@ -161,7 +161,7 @@ class cmd_check : public command_t long x = 0; /* hostname or other */ - for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++) + for (user_hash::const_iterator a = ServerInstance->clientlist.begin(); a != ServerInstance->clientlist.end(); a++) { if (match(a->second->host, parameters[0]) || match(a->second->dhost, parameters[0])) { diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 544cc1475..fa4f27f04 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -28,8 +28,6 @@ using namespace std; /* $ModDesc: Provides statistics over HTTP via m_httpd.so */ -extern user_hash clientlist; -extern chan_hash chanlist; extern std::vector<userrec*> all_opers; extern InspIRCd* ServerInstance; @@ -115,8 +113,8 @@ class ModuleHttpStats : public Module data << "<div class='totals'>"; data << "<h2>Totals</h2>"; data << "<table>"; - data << "<tr><td>Users</td><td>" << clientlist.size() << "</td></tr>"; - data << "<tr><td>Channels</td><td>" << chanlist.size() << "</td></tr>"; + data << "<tr><td>Users</td><td>" << ServerInstance->clientlist.size() << "</td></tr>"; + data << "<tr><td>Channels</td><td>" << ServerInstance->chanlist.size() << "</td></tr>"; data << "<tr><td>Opers</td><td>" << all_opers.size() << "</td></tr>"; data << "<tr><td>Sockets</td><td>" << (ServerInstance->SE->GetMaxFds() - ServerInstance->SE->GetRemainingFds()) << " (Max: " << ServerInstance->SE->GetMaxFds() << " via socket engine '" << ServerInstance->SE->GetName() << "')</td></tr>"; data << "</table>"; diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 208e55de2..ae45c67a3 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -25,7 +25,7 @@ using namespace std; /* $ModDesc: Provides channel mode +L (limit redirection) */ -extern chan_hash chanlist; +extern InspIRCd* ServerInstance; class Redirect : public ModeHandler { @@ -74,7 +74,7 @@ class Redirect : public ModeHandler } else { - for (chan_hash::const_iterator i = chanlist.begin(); i != chanlist.end(); i++) + for (chan_hash::const_iterator i = ServerInstance->chanlist.begin(); i != ServerInstance->chanlist.end(); i++) { if ((i->second != channel) && (i->second->IsModeSet('L')) && (irc::string(i->second->GetModeParameter('L').c_str()) == irc::string(channel->name))) { 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(); diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp index 6ee4d9176..47f82200e 100644 --- a/src/modules/m_tline.cpp +++ b/src/modules/m_tline.cpp @@ -22,12 +22,13 @@ using namespace std; #include "modules.h" #include "helperfuncs.h" #include "wildcard.h" +#include "inspircd.h" #include "dns.h" /* $ModDesc: Provides /tline command used to test who a mask matches */ static Server *Srv; -extern user_hash clientlist; +extern InspIRCd* ServerInstance; class cmd_tline : public command_t { @@ -45,7 +46,7 @@ class cmd_tline : public command_t float n_match_host = 0; float n_match_ip = 0; - for (user_hash::const_iterator u = clientlist.begin(); u != clientlist.end(); u++) + for (user_hash::const_iterator u = ServerInstance->clientlist.begin(); u != ServerInstance->clientlist.end(); u++) { n_counted++; if (match(u->second->GetFullRealHost(),parameters[0])) |