X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_httpd_stats.cpp;h=157f772c113fa453dce821e3e9f72e8afcd3fff7;hb=8e8445d1c0744130f232d3c6f56d5fe1079773ad;hp=9e89bd1497e25688eb16fcf97658219b67416f57;hpb=4e7c9f5a9257723765f9994aff90440a0b6cf3c9;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 9e89bd149..157f772c1 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * InspIRCd: (C) 2002-2008 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -46,6 +46,8 @@ class ModuleHttpStats : public Module { ReadConfig(); this->changed = true; + Implementation eventlist[] = { I_OnEvent, I_OnRequest, I_OnChannelDelete, I_OnUserJoin, I_OnUserPart, I_OnUserQuit }; + ServerInstance->Modules->Attach(eventlist, this, 6); } void InsertOrder(irc::string channel, int count) @@ -71,7 +73,7 @@ class ModuleHttpStats : public Module so->clear(); for (StatsIter a = sh->begin(); a != sh->end(); a++) InsertOrder(a->first, a->second); - for (user_hash::iterator u = ServerInstance->clientlist->begin(); u != ServerInstance->clientlist->end(); u++) + for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); u++) { StatsHash::iterator n = Servers->find(u->second->server); if (n != Servers->end()) @@ -101,9 +103,9 @@ class ModuleHttpStats : public Module data << "" << ServerInstance->Config->ServerName << "" << ServerInstance->Config->ServerDesc << ""; data << ""; - data << "" << ServerInstance->clientlist->size() << ""; + data << "" << ServerInstance->Users->clientlist->size() << ""; data << "" << ServerInstance->chanlist->size() << ""; - data << "" << ServerInstance->all_opers.size() << ""; + data << "" << ServerInstance->Users->all_opers.size() << ""; data << "" << (ServerInstance->SE->GetMaxFds() - ServerInstance->SE->GetRemainingFds()) << "" << ServerInstance->SE->GetMaxFds() << "" << ServerInstance->SE->GetName() << ""; @@ -117,14 +119,12 @@ class ModuleHttpStats : public Module data << ""; data << ""; - for (int i = 0; i <= ServerInstance->GetModuleCount(); i++) + std::vector module_names = ServerInstance->Modules->GetAllModuleNames(0); + for (std::vector::iterator i = module_names.begin(); i != module_names.end(); ++i) { - if (!ServerInstance->Config->module_names[i].empty()) - { - Version v = ServerInstance->modules[i]->GetVersion(); - data << "" << ServerInstance->Config->module_names[i] << "" << - v.Major << "." << v.Minor << "." << v.Revision << "." << v.Build << ""; - } + Module* m = ServerInstance->Modules->Find(i->c_str()); + Version v = m->GetVersion(); + data << "" << *i << "" << v.Major << "." << v.Minor << "." << v.Revision << "." << v.Build << ""; } data << ""; @@ -137,7 +137,7 @@ class ModuleHttpStats : public Module for (SortedIter a = so->begin(); a != so->end(); a++) { - chanrec* c = ServerInstance->FindChan(a->second.c_str()); + Channel* c = ServerInstance->FindChan(a->second.c_str()); if (c && !c->IsModeSet('s') && !c->IsModeSet('p')) { data << ""; @@ -176,7 +176,7 @@ class ModuleHttpStats : public Module } } - void OnChannelDelete(chanrec* chan) + void OnChannelDelete(Channel* chan) { StatsIter a = sh->find(chan->name); if (a != sh->end()) @@ -186,7 +186,7 @@ class ModuleHttpStats : public Module this->changed = true; } - void OnUserJoin(userrec* user, chanrec* channel, bool &silent) + void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent) { StatsIter a = sh->find(channel->name); if (a != sh->end()) @@ -201,7 +201,7 @@ class ModuleHttpStats : public Module this->changed = true; } - void OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage, bool &silent) + void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent) { StatsIter a = sh->find(channel->name); if (a != sh->end()) @@ -211,11 +211,11 @@ class ModuleHttpStats : public Module this->changed = true; } - void OnUserQuit(userrec* user, const std::string &message, const std::string &oper_message) + void OnUserQuit(User* user, const std::string &message, const std::string &oper_message) { for (UCListIter v = user->chans.begin(); v != user->chans.end(); v++) { - chanrec* c = v->first; + Channel* c = v->first; StatsIter a = sh->find(c->name); if (a != sh->end()) { @@ -225,15 +225,11 @@ class ModuleHttpStats : public Module this->changed = true; } - char* OnRequest(Request* request) + const char* OnRequest(Request* request) { return NULL; } - void Implements(char* List) - { - List[I_OnEvent] = List[I_OnRequest] = List[I_OnChannelDelete] = List[I_OnUserJoin] = List[I_OnUserPart] = List[I_OnUserQuit] = 1; - } virtual ~ModuleHttpStats() { @@ -243,7 +239,7 @@ class ModuleHttpStats : public Module virtual Version GetVersion() { - return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION); + return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION); } };