]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_httpd.cpp
Wahhhhhhhhhhhh bwahahaha. Mass commit to tidy up tons of messy include lists
[user/henk/code/inspircd.git] / src / modules / m_httpd.cpp
index c433553beebc8e7ee0b9ac22ddb953072be927ca..b1dc7b6101ee93cc964a5aa534459207b0b2e469 100644 (file)
@@ -21,7 +21,7 @@ using namespace std;
 #include "channels.h"
 #include "modules.h"
 #include "inspsocket.h"
-#include "helperfuncs.h"
+
 #include "inspircd.h"
 #include "httpd.h"
 
@@ -51,7 +51,7 @@ class HttpSocket : public InspSocket
 
        HttpSocket(InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, FileReader* index_page) : InspSocket(SI, host, port, listening, maxtime), index(index_page)
        {
-               log(DEBUG,"HttpSocket constructor");
+               SI->Log(DEBUG,"HttpSocket constructor");
                InternalState = HTTP_LISTEN;
        }
 
@@ -65,7 +65,7 @@ class HttpSocket : public InspSocket
                if (InternalState == HTTP_LISTEN)
                {
                        HttpSocket* s = new HttpSocket(this->Instance, newsock, ip, index);
-                       this->Instance->AddSocket(s);
+                       s = s; /* Stop GCC whining */
                }
                return true;
        }
@@ -167,7 +167,8 @@ class HttpSocket : public InspSocket
 
        void SendHeaders(unsigned long size, int response, const std::string &extraheaders)
        {
-               struct tm *timeinfo = localtime(&TIME);
+               time_t local = this->Instance->Time();
+               struct tm *timeinfo = localtime(&local);
                this->Write("HTTP/1.1 "+ConvToStr(response)+" "+Response(response)+"\r\nDate: ");
                this->Write(asctime(timeinfo));
                if (extraheaders.empty())
@@ -224,7 +225,7 @@ class HttpSocket : public InspSocket
                                                if (!claimed)
                                                {
                                                        SendHeaders(0, 404, "");
-                                                       log(DEBUG,"Page not claimed, 404");
+                                                       Instance->Log(DEBUG,"Page not claimed, 404");
                                                }
                                        }
                                }
@@ -244,7 +245,7 @@ class HttpSocket : public InspSocket
 
        void Page(std::stringstream* n, int response, std::string& extraheaders)
        {
-               log(DEBUG,"Sending page");
+               Instance->Log(DEBUG,"Sending page");
                SendHeaders(n->str().length(), response, extraheaders);
                this->Write(n->str());
        }
@@ -282,10 +283,6 @@ class ModuleHttp : public Module
        void CreateListener()
        {
                http = new HttpSocket(ServerInstance, this->bindip, this->port, true, 0, index);
-               if ((http) && (http->GetState() == I_LISTENING))
-               {
-                       ServerInstance->AddSocket(http);
-               }
        }
 
        ModuleHttp(InspIRCd* Me) : Module::Module(Me)
@@ -301,7 +298,7 @@ class ModuleHttp : public Module
 
        char* OnRequest(Request* request)
        {
-               log(DEBUG,"Got HTTPDocument object");
+               ServerInstance->Log(DEBUG,"Got HTTPDocument object");
                claimed = true;
                HTTPDocument* doc = (HTTPDocument*)request->GetData();
                HttpSocket* sock = (HttpSocket*)doc->sock;
@@ -316,7 +313,7 @@ class ModuleHttp : public Module
 
        virtual ~ModuleHttp()
        {
-               ServerInstance->DelSocket(http);
+               ServerInstance->SE->DelFd(http);
        }
 
        virtual Version GetVersion()