]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_httpd_config.cpp
Update Event and Request APIs
[user/henk/code/inspircd.git] / src / modules / m_httpd_config.cpp
index 55f943d2c33f32b8f0fafe7792a88a915902c1c4..988ba397790cf3d30cc3f3506f18386203bef678 100644 (file)
@@ -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)
@@ -73,14 +73,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() == "/config") || (http->GetURI() == "/config/"))
                        {
@@ -99,21 +99,14 @@ class ModuleHttpStats : public Module
 
                                data << "</body></html>";
                                /* 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_config.so");
                                response.headers.SetHeader("Content-Type", "text/html");
-                               Request req((char*)&response, (Module*)this, event->GetSource());
-                               req.Send();
+                               response.Send();
                        }
                }
        }
 
-       const char* OnRequest(Request* request)
-       {
-               return NULL;
-       }
-
-
        virtual ~ModuleHttpStats()
        {
        }