X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_httpd_stats.cpp;h=df98ef3f535e51ea63ca5a6e100fd72a458b4692;hb=67de413cad88194972d55a8ff88464370890c5a9;hp=7d7ebcf3d662d46332d87b06342524cecd38c998;hpb=debedfeb0abb398443fa33452f486c6cc80bb832;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 7d7ebcf3d..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() + ModuleHttpStats() + : API(this) { - Implementation eventlist[] = { I_OnEvent }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } std::string Sanitize(const std::string &str) @@ -91,13 +88,13 @@ class ModuleHttpStats : public Module data << ""; } - void OnEvent(Event& event) + void OnEvent(Event& event) CXX11_OVERRIDE { std::stringstream data(""); 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/")) @@ -196,7 +193,7 @@ class ModuleHttpStats : public Module if (u->IsAway()) data << "" << Sanitize(u->awaymsg) << "" << u->awaytime << ""; if (u->IsOper()) - data << "" << Sanitize(u->oper->NameStr()) << ""; + data << "" << Sanitize(u->oper->name) << ""; data << "" << u->FormatModes() << "" << Sanitize(u->ident) << ""; LocalUser* lu = IS_LOCAL(u); if (lu) @@ -231,14 +228,14 @@ 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); } } } - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Provides statistics over HTTP via m_httpd.so", VF_VENDOR); }