X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_httpd_config.cpp;h=3c468079925a3ca0cc16c93548fc2316129546e0;hb=2a924db786cfb2531126f56a8227bd46c63e444c;hp=88594e2fe288ae19cb6c38b2d43c64c5f170d850;hpb=645f7e18c64a6628ede880dc69bf8825ba93b375;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index 88594e2fe..3c4680799 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -19,18 +19,16 @@ #include "inspircd.h" -#include "httpd.h" -#include "protocol.h" - -/* $ModDesc: Allows for the server configuration to be viewed over HTTP via m_httpd.so */ +#include "modules/httpd.h" class ModuleHttpConfig : public Module { + HTTPdAPI API; + public: - void init() + ModuleHttpConfig() + : API(this) { - Implementation eventlist[] = { I_OnEvent }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } std::string Sanitize(const std::string &str) @@ -67,13 +65,13 @@ class ModuleHttpConfig : public Module return ret; } - 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() == "/config") || (http->GetURI() == "/config/")) @@ -95,14 +93,14 @@ class ModuleHttpConfig : public Module data << ""; /* Send the document back to m_httpd */ HTTPDocumentResponse response(this, *http, &data, 200); - response.headers.SetHeader("X-Powered-By", "m_httpd_config.so"); + response.headers.SetHeader("X-Powered-By", MODNAME); response.headers.SetHeader("Content-Type", "text/html"); - response.Send(); + API->SendResponse(response); } } } - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Allows for the server configuration to be viewed over HTTP via m_httpd.so", VF_VENDOR); }