X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodules%2Fm_httpd_stats.cpp;h=faf42d071e5793d7f0c94aab7f936b154f08221c;hb=f2cdf27dd9c45f91f4184b81ea3b9be7c5d88173;hp=2eb9f7cb75b87719b0ea22347fb380fdeb6a807a;hpb=645f7e18c64a6628ede880dc69bf8825ba93b375;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 2eb9f7cb7..faf42d071 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -22,7 +22,7 @@ #include "inspircd.h" -#include "httpd.h" +#include "modules/httpd.h" #include "xline.h" #include "protocol.h" @@ -31,10 +31,15 @@ class ModuleHttpStats : public Module { static std::map const &entities; + HTTPdAPI API; public: + ModuleHttpStats() + : API(this) + { + } - void init() + void init() CXX11_OVERRIDE { Implementation eventlist[] = { I_OnEvent }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); @@ -91,13 +96,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("m_http_stats", LOG_DEBUG, "Handling httpd event"); HTTPRequest* http = (HTTPRequest*)&event; if ((http->GetURI() == "/stats") || (http->GetURI() == "/stats/")) @@ -196,7 +201,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) @@ -233,12 +238,12 @@ class ModuleHttpStats : public Module HTTPDocumentResponse response(this, *http, &data, 200); response.headers.SetHeader("X-Powered-By", "m_httpd_stats.so"); 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); }