X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_httpd_stats.cpp;h=df98ef3f535e51ea63ca5a6e100fd72a458b4692;hb=e950f568d0f571e9475aa38177486468714de4d3;hp=8f25415a95117e40a06154d222d2a3b95c9b8dce;hpb=c5a46583800374344d8676eccd7061a15a5ac1ce;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 8f25415a9..df98ef3f5 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -26,18 +26,15 @@ #include "xline.h" #include "protocol.h" -/* $ModDesc: Provides statistics over HTTP via m_httpd.so */ - class ModuleHttpStats : public Module { static std::map const &entities; + HTTPdAPI API; public: - - void init() CXX11_OVERRIDE + ModuleHttpStats() + : API(this) { - Implementation eventlist[] = { I_OnEvent }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } std::string Sanitize(const std::string &str) @@ -97,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/")) @@ -231,9 +228,9 @@ 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"); - response.Send(); + API->SendResponse(response); } } }