]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_http_client.cpp
Damn strict typing to hell
[user/henk/code/inspircd.git] / src / modules / m_http_client.cpp
index 4b31fadd77c03af43c739c23d185dbc0929f44ea..a2f80687fa4306ca927f188ef67e3dd6254399bf 100644 (file)
@@ -56,14 +56,16 @@ class HTTPResolver : public Resolver
        {
        }
        
-       void OnLookupComplete(const string &result, unsigned int ttl, bool cached)
+       void OnLookupComplete(const string &result, unsigned int ttl, bool cached, int resultnum = 0)
        {
-               socket->Connect(result);
+               if (!resultnum)
+                       socket->Connect(result);
        }
        
        void OnError(ResolverError e, const string &errmsg)
        {
-               delete socket;
+               if (ServerInstance->SocketCull.find(socket) == ServerInstance->SocketCull.end())
+                       ServerInstance->SocketCull[socket] = socket;
        }
 };
 
@@ -174,10 +176,10 @@ bool HTTPSocket::ParseURL(const std::string &iurl)
        
        for (int p = 0;; p++)
        {
-               std::string part = tokenizer.GetToken();
-               if (part.empty() && tokenizer.StreamEnd())
+               std::string part;
+               if (!tokenizer.GetToken(part))
                        break;
-               
+
                if ((p == 0) && (part[part.length() - 1] == ':'))
                {
                        // Protocol ('http:')
@@ -343,24 +345,4 @@ void HTTPSocket::OnClose()
        delete response;
 }
 
-class ModuleHTTPClientFactory : public ModuleFactory
-{
- public:
-       ModuleHTTPClientFactory()
-       {
-       }
-       
-       ~ModuleHTTPClientFactory()
-       {
-       }
-       
-       Module *CreateModule(InspIRCd* Me)
-       {
-               return new ModuleHTTPClient(Me);
-       }
-};
-
-extern "C" DllExport void *init_module(void)
-{
-       return new ModuleHTTPClientFactory;
-}
+MODULE_INIT(ModuleHTTPClient)