diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-02-12 16:35:02 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-02-12 16:35:02 +0100 |
commit | ae6967b8b30ebc956e3158127ecba5d01dc09204 (patch) | |
tree | b0940ea9cbd75acfdaa655b3a9975f67e3f8ae48 /src/modules/m_httpd_config.cpp | |
parent | a7aa76f17ac22897e08558f0f78d891d3d4f7de6 (diff) | |
parent | 7918febc630d7d6f94fda1a918fe7b98c2d0e742 (diff) |
Merge branch 'master+crossmodevents'
Diffstat (limited to 'src/modules/m_httpd_config.cpp')
-rw-r--r-- | src/modules/m_httpd_config.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index 3c4680799..6fd7f4050 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -21,13 +21,14 @@ #include "inspircd.h" #include "modules/httpd.h" -class ModuleHttpConfig : public Module +class ModuleHttpConfig : public Module, public HTTPRequestEventListener { HTTPdAPI API; public: ModuleHttpConfig() - : API(this) + : HTTPRequestEventListener(this) + , API(this) { } @@ -65,14 +66,12 @@ class ModuleHttpConfig : public Module return ret; } - void OnEvent(Event& event) CXX11_OVERRIDE + ModResult HandleRequest(HTTPRequest* http) { std::stringstream data(""); - if (event.id == "httpd_url") { ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling httpd event"); - HTTPRequest* http = (HTTPRequest*)&event; if ((http->GetURI() == "/config") || (http->GetURI() == "/config/")) { @@ -96,8 +95,15 @@ class ModuleHttpConfig : public Module response.headers.SetHeader("X-Powered-By", MODNAME); response.headers.SetHeader("Content-Type", "text/html"); API->SendResponse(response); + return MOD_RES_DENY; // Handled } } + return MOD_RES_PASSTHRU; + } + + ModResult OnHTTPRequest(HTTPRequest& req) CXX11_OVERRIDE + { + return HandleRequest(&req); } Version GetVersion() CXX11_OVERRIDE |