]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_jumpserver.cpp
Change type of log messages to MODNAME in several modules
[user/henk/code/inspircd.git] / src / modules / m_jumpserver.cpp
index 81022a9076ad5fbe7cceb2d13895123779718f84..89391c8a4bf6268e3ae8c6e438787049e1491bf0 100644 (file)
@@ -108,12 +108,15 @@ class CommandJumpserver : public Command
                        if (redirect_all_immediately)
                        {
                                /* Redirect everyone but the oper sending the command */
-                               for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
+                               const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+                               for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); )
                                {
+                                       // Quitting the user removes it from the list
                                        LocalUser* t = *i;
+                                       ++i;
                                        if (!t->IsOper())
                                        {
-                                               t->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead", t->nick.c_str(), parameters[0].c_str(), GetPort(t));
+                                               t->WriteNumeric(RPL_REDIR, parameters[0], GetPort(t), "Please use this Server/Port instead");
                                                ServerInstance->Users->QuitUser(t, reason);
                                                n_done++;
                                        }
@@ -137,7 +140,7 @@ class CommandJumpserver : public Command
 
        int GetPort(LocalUser* user)
        {
-               int p = (SSLClientCert::GetCertificate(&user->eh) ? sslport : port);
+               int p = (SSLIOHook::IsSSL(&user->eh) ? sslport : port);
                if (p == 0)
                        p = user->GetServerPort();
                return p;
@@ -152,28 +155,23 @@ class ModuleJumpServer : public Module
        {
        }
 
-       void init() CXX11_OVERRIDE
-       {
-               ServerInstance->Modules->AddService(js);
-       }
-
        ModResult OnUserRegister(LocalUser* user) CXX11_OVERRIDE
        {
                if (js.redirect_new_users)
                {
                        int port = js.GetPort(user);
-                       user->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead",
-                               user->nick.c_str(), js.redirect_to.c_str(), port);
+                       user->WriteNumeric(RPL_REDIR, js.redirect_to, port, "Please use this Server/Port instead");
                        ServerInstance->Users->QuitUser(user, js.reason);
-                       return MOD_RES_PASSTHRU;
+                       return MOD_RES_DENY;
                }
                return MOD_RES_PASSTHRU;
        }
 
-       void OnRehash(User* user) CXX11_OVERRIDE
+       void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
                // Emergency way to unlock
-               if (!user) js.redirect_new_users = false;
+               if (!status.srcuser)
+                       js.redirect_new_users = false;
        }
 
        Version GetVersion() CXX11_OVERRIDE