diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-08 23:29:21 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-08 23:29:21 +0000 |
commit | 7e843c22e16c81054bad18073d24fe1a07026431 (patch) | |
tree | 44ca0213c7d7a80270b993fec1fbed275ec56424 /src/modules/m_httpd_stats.cpp | |
parent | c440038736f749a56dbac1badee5b2f099286117 (diff) |
Update Event and Request APIs
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11808 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_httpd_stats.cpp')
-rw-r--r-- | src/modules/m_httpd_stats.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 46f474e2d..5e30c90ca 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -35,8 +35,8 @@ class ModuleHttpStats : public Module ModuleHttpStats() { ReadConfig(); this->changed = true; - Implementation eventlist[] = { I_OnEvent, I_OnRequest }; - ServerInstance->Modules->Attach(eventlist, this, 2); + Implementation eventlist[] = { I_OnEvent }; + ServerInstance->Modules->Attach(eventlist, this, 1); } std::string Sanitize(const std::string &str) @@ -67,14 +67,14 @@ class ModuleHttpStats : public Module return ret; } - void OnEvent(Event* event) + void OnEvent(Event& event) { std::stringstream data(""); - if (event->GetEventID() == "httpd_url") + if (event.id == "httpd_url") { ServerInstance->Logs->Log("m_http_stats", DEBUG,"Handling httpd event"); - HTTPRequest* http = (HTTPRequest*)event->GetData(); + HTTPRequest* http = (HTTPRequest*)&event; if ((http->GetURI() == "/stats") || (http->GetURI() == "/stats/")) { @@ -172,21 +172,14 @@ class ModuleHttpStats : public Module data << "</inspircdstats>"; /* Send the document back to m_httpd */ - HTTPDocument response(http->sock, &data, 200); + HTTPDocumentResponse response(this, *http, &data, 200); response.headers.SetHeader("X-Powered-By", "m_httpd_stats.so"); response.headers.SetHeader("Content-Type", "text/xml"); - Request req((char*)&response, (Module*)this, event->GetSource()); - req.Send(); + response.Send(); } } } - const char* OnRequest(Request* request) - { - return NULL; - } - - virtual ~ModuleHttpStats() { } |