X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_httpd_stats.cpp;h=346fe41f51cce2a2f011f9ba2665cc78ef1618a0;hb=ad47ea662698e72ff8f79b03512b1e7fe81bdf53;hp=e30aced4b69ce1ef4fdcfd59e3a6e4487df83e9f;hpb=fd0fa86da89ab4cefa778307088ef2552a05a170;p=user%2Fhenk%2Fcode%2Finspircd.git
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index e30aced4b..346fe41f5 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -37,12 +37,6 @@ class ModuleHttpStats : public Module
{
}
- void init() CXX11_OVERRIDE
- {
- Implementation eventlist[] = { I_OnEvent };
- ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
- }
-
std::string Sanitize(const std::string &str)
{
std::string ret;
@@ -100,7 +94,7 @@ class ModuleHttpStats : public Module
if (event.id == "httpd_url")
{
- ServerInstance->Logs->Log("m_http_stats", LOG_DEBUG, "Handling httpd event");
+ ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling httpd event");
HTTPRequest* http = (HTTPRequest*)&event;
if ((http->GetURI() == "/stats") || (http->GetURI() == "/stats/"))
@@ -147,13 +141,12 @@ class ModuleHttpStats : public Module
}
data << "";
- std::vector module_names = ServerInstance->Modules->GetAllModuleNames(0);
+ const ModuleManager::ModuleMap& mods = ServerInstance->Modules->GetModules();
- for (std::vector::iterator i = module_names.begin(); i != module_names.end(); ++i)
+ for (ModuleManager::ModuleMap::const_iterator i = mods.begin(); i != mods.end(); ++i)
{
- Module* m = ServerInstance->Modules->Find(i->c_str());
- Version v = m->GetVersion();
- data << "" << *i << "" << Sanitize(v.description) << "";
+ Version v = i->second->GetVersion();
+ data << "" << i->first << "" << Sanitize(v.description) << "";
}
data << "";
@@ -204,7 +197,7 @@ class ModuleHttpStats : public Module
LocalUser* lu = IS_LOCAL(u);
if (lu)
data << "" << lu->GetServerPort() << ""
- << irc::sockets::satouser(lu->server_sa) << "";
+ << lu->server_sa.str() << "";
data << "" << u->GetIPString() << "";
DumpMeta(data, u);
@@ -214,10 +207,10 @@ class ModuleHttpStats : public Module
data << "";
- ProtoServerList sl;
+ ProtocolInterface::ServerList sl;
ServerInstance->PI->GetServerList(sl);
- for (ProtoServerList::iterator b = sl.begin(); b != sl.end(); ++b)
+ for (ProtocolInterface::ServerList::const_iterator b = sl.begin(); b != sl.end(); ++b)
{
data << "";
data << "" << b->servername << "";
@@ -234,7 +227,7 @@ class ModuleHttpStats : public Module
/* Send the document back to m_httpd */
HTTPDocumentResponse response(this, *http, &data, 200);
- response.headers.SetHeader("X-Powered-By", "m_httpd_stats.so");
+ response.headers.SetHeader("X-Powered-By", MODNAME);
response.headers.SetHeader("Content-Type", "text/xml");
API->SendResponse(response);
}