]> 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 86e726189a5ca973925ac0450ec5987e1340e732..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());
                }