]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_xmlsocket.cpp
Add 906, sasl aborted
[user/henk/code/inspircd.git] / src / modules / m_xmlsocket.cpp
index d97d40f87faf9566780d4cf63f87b9756cfe08d2..cacd1f3484b72f65cefad7a8829cd21b31b2e832 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -26,9 +26,11 @@ class ModuleXMLSocket : public Module
                : Module(Me)
        {
                OnRehash(NULL,"");
+               Implementation eventlist[] = { I_OnUnloadModule, I_OnRawSocketRead, I_OnRawSocketWrite, I_OnRehash };
+               ServerInstance->Modules->Attach(eventlist, this, 4);
        }
 
-       virtual void OnRehash(userrec* user, const std::string &param)
+       virtual void OnRehash(User* user, const std::string &param)
        {
 
                Conf = new ConfigReader(ServerInstance);
@@ -57,24 +59,24 @@ class ModuleXMLSocket : public Module
                                                if (ServerInstance->Config->AddIOHook(portno, this))
                                                {
                                                        listenports.push_back(portno);
-                                                               for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++)
-                                                               if (ServerInstance->Config->ports[i]->GetPort() == portno)
-                                                                       ServerInstance->Config->ports[i]->SetDescription("xml");
+                                                               for (size_t j = 0; j < ServerInstance->Config->ports.size(); j++)
+                                                               if (ServerInstance->Config->ports[j]->GetPort() == portno)
+                                                                       ServerInstance->Config->ports[j]->SetDescription("xml");
                                                }
                                                else
                                                {
-                                                       ServerInstance->Log(DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d, maybe you have another similar module loaded?", portno);
+                                                       ServerInstance->Logs->Log("m_xmlsocket",DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d, maybe you have another similar module loaded?", portno);
                                                }
                                        }
                                        catch (ModuleException &e)
                                        {
-                                               ServerInstance->Log(DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another similar module loaded?", portno, e.GetReason());
+                                               ServerInstance->Logs->Log("m_xmlsocket",DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another similar module loaded?", portno, e.GetReason());
                                        }
                                }
                        }
                }
 
-               DELETE(Conf);
+               delete Conf;
        }
 
        virtual ~ModuleXMLSocket()
@@ -100,14 +102,10 @@ class ModuleXMLSocket : public Module
                return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
        }
 
-       void Implements(char* List)
-       {
-               List[I_OnUnloadModule] = List[I_OnRawSocketRead] = List[I_OnRawSocketWrite] = List[I_OnRehash] = 1;
-       }
 
        virtual int OnRawSocketRead(int fd, char* buffer, unsigned int count, int &readresult)
        {
-               userrec* user = dynamic_cast<userrec*>(ServerInstance->FindDescriptor(fd));
+               User* user = dynamic_cast<User*>(ServerInstance->FindDescriptor(fd));
 
                if (user == NULL)
                        return -1;
@@ -135,7 +133,7 @@ class ModuleXMLSocket : public Module
 
        virtual int OnRawSocketWrite(int fd, const char* buffer, int count)
        {
-               userrec* user = dynamic_cast<userrec*>(ServerInstance->FindDescriptor(fd));
+               User* user = dynamic_cast<User*>(ServerInstance->FindDescriptor(fd));
 
                if (user == NULL)
                        return -1;