]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_xmlsocket.cpp
Allow support for multiple dns results per request. This is a significant change...
[user/henk/code/inspircd.git] / src / modules / m_xmlsocket.cpp
index 1cf9fafa21387959c543634c08c280a49f521125..7f37f66c91dcb1a75366c79463bb825da517d470 100644 (file)
  * ---------------------------------------------------
  */
 
-#include "inspircd_config.h"
-#include "configreader.h"
+#include "inspircd.h"
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
 #include "hashcomp.h"
-#include "inspircd.h"
 
 /* $ModDesc: Provides XMLSocket support for clients */
 
@@ -29,7 +27,7 @@ class ModuleXMLSocket : public Module
  public:
 
        ModuleXMLSocket(InspIRCd* Me)
-               : Module::Module(Me)
+               : Module(Me)
        {
                OnRehash(NULL,"");
        }
@@ -49,7 +47,8 @@ class ModuleXMLSocket : public Module
                for (int i = 0; i < Conf->Enumerate("bind"); i++)
                {
                        // For each <bind> tag
-                       if (((Conf->ReadValue("bind", "type", i) == "") || (Conf->ReadValue("bind", "type", i) == "clients")) && (Conf->ReadFlag("bind", "xmlsocket", i)))
+                       std::string x = Conf->ReadValue("bind", "type", i);
+                       if (((x.empty()) || (x == "clients")) && (Conf->ReadFlag("bind", "xmlsocket", i)))
                        {
                                // Get the port we're meant to be listening on with SSL
                                std::string port = Conf->ReadValue("bind", "port", i);
@@ -146,7 +145,7 @@ class ModuleXMLSocket : public Module
                        return -1;
 
                /* We want to alter the buffer, so we have to make a copy */
-               char tmpbuffer[count+1];
+               char * tmpbuffer = new char[count + 1];
                memcpy(tmpbuffer, buffer, count);
 
                /* XXX: This will actually generate lines "looking\0\0like\0\0this"
@@ -160,31 +159,12 @@ class ModuleXMLSocket : public Module
                                tmpbuffer[n] = 0;
 
                user->AddWriteBuf(std::string(tmpbuffer,count));
+               delete [] tmpbuffer;
 
                return 1;
        }
 
 };
 
-class ModuleXMLSocketFactory : public ModuleFactory
-{
- public:
-       ModuleXMLSocketFactory()
-       {
-       }
+MODULE_INIT(ModuleXMLSocket)
 
-       ~ModuleXMLSocketFactory()
-       {
-       }
-
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleXMLSocket(Me);
-       }
-};
-
-
-extern "C" void * init_module( void )
-{
-       return new ModuleXMLSocketFactory;
-}