X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_xmlsocket.cpp;h=7f37f66c91dcb1a75366c79463bb825da517d470;hb=df4f0dc888a2a24e7f8b42a1c21670679e633506;hp=1cf9fafa21387959c543634c08c280a49f521125;hpb=bfcaef8623bb3f8faf1141eb7b3805ab75ae97dd;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_xmlsocket.cpp b/src/modules/m_xmlsocket.cpp index 1cf9fafa2..7f37f66c9 100644 --- a/src/modules/m_xmlsocket.cpp +++ b/src/modules/m_xmlsocket.cpp @@ -11,13 +11,11 @@ * --------------------------------------------------- */ -#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 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; -}