]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ssl_gnutls.cpp
Fix various rline bugs, implement /stats R, and fix the issue where you get no error...
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_gnutls.cpp
index 910ff4a2126df35760639b706a7b99efbcc04056..debad4f89aed188d6bfae4064601a06bce1ff5b3 100644 (file)
@@ -81,10 +81,10 @@ class CommandStartTLS : public Command
                }
                else
                {
-                       if (!user->io)
+                       if (!user->GetIOHook())
                        {
                                user->WriteNumeric(670, "%s :STARTTLS successful, go ahead with TLS handshake", user->nick.c_str());
-                               user->io = Caller;
+                               user->AddIOHook(Caller);
                                Caller->OnRawSocketAccept(user->GetFd(), user->GetIPString(), user->GetPort());
                        }
                        else
@@ -303,12 +303,12 @@ class ModuleSSLGnuTLS : public Module
                {
                        User* user = (User*)item;
 
-                       if (user->io == this)
+                       if (user->GetIOHook() == this)
                        {
                                // User is using SSL, they're a local user, and they're using one of *our* SSL ports.
                                // Potentially there could be multiple SSL modules loaded at once on different ports.
                                ServerInstance->Users->QuitUser(user, "SSL module unloading");
-                               user->io = NULL;
+                               user->DelIOHook();
                        }
                        if (user->GetExt("ssl_cert", dummy))
                        {
@@ -346,10 +346,10 @@ class ModuleSSLGnuTLS : public Module
 
        virtual void OnHookUserIO(User* user, const std::string &targetip)
        {
-               if (!user->io && isin(targetip,user->GetPort(),listenports))
+               if (!user->GetIOHook() && isin(targetip,user->GetPort(),listenports))
                {
                        /* Hook the user with our module */
-                       user->io = this;
+                       user->AddIOHook(this);
                }
        }
 
@@ -365,7 +365,7 @@ class ModuleSSLGnuTLS : public Module
                        const char* ret = "OK";
                        try
                        {
-                               ret = ServerInstance->Config->AddIOHook((Module*)this, (BufferedSocket*)ISR->Sock) ? "OK" : NULL;
+                               ret = ISR->Sock->AddIOHook((Module*)this) ? "OK" : NULL;
                        }
                        catch (ModuleException &e)
                        {
@@ -375,7 +375,7 @@ class ModuleSSLGnuTLS : public Module
                }
                else if (strcmp("IS_UNHOOK", request->GetId()) == 0)
                {
-                       return ServerInstance->Config->DelIOHook((BufferedSocket*)ISR->Sock) ? "OK" : NULL;
+                       return ISR->Sock->DelIOHook() ? "OK" : NULL;
                }
                else if (strcmp("IS_HSDONE", request->GetId()) == 0)
                {
@@ -646,7 +646,7 @@ class ModuleSSLGnuTLS : public Module
                        return;
 
                // Bugfix, only send this numeric for *our* SSL users
-               if (dest->GetExt("ssl", dummy) || ((IS_LOCAL(dest) && (dest->io == this))))
+               if (dest->GetExt("ssl", dummy) || ((IS_LOCAL(dest) && (dest->GetIOHook() == this))))
                {
                        ServerInstance->SendWhoisLine(source, dest, 320, "%s %s :is using a secure connection", source->nick.c_str(), dest->nick.c_str());
                }
@@ -920,20 +920,6 @@ class ModuleSSLGnuTLS : public Module
        void OnEvent(Event* ev)
        {
                GenericCapHandler(ev, "tls", "tls");
-               if (ev->GetEventID() == "cap_req")
-               {
-                       /* GenericCapHandler() Extends("tls") a user if it does
-                        * CAP REQ tls. Check if this was done.
-                        */
-                       CapData *data = (CapData *) ev->GetData();
-                       if (data->user->Shrink("tls"))
-                       {
-                               /* Not in our spec?!?! */
-                               data->user->io = this;
-                               OnRawSocketAccept(data->user->GetFd(), data->user->GetIPString(),
-                                               data->user->GetPort());
-                       }
-               }
        }
 
        void Prioritize()