]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_conn_umodes.cpp
Convert a bunch of time-related config options to getDuration.
[user/henk/code/inspircd.git] / src / modules / m_conn_umodes.cpp
index a21462ddf39a79b33dc91e537f43ee2cd802d8c0..0b708641e9124219ce66a5f9855c7f763a3b6e38 100644 (file)
 
 #include "inspircd.h"
 
-/* $ModDesc: Sets (and unsets) modes on users when they connect */
-
 class ModuleModesOnConnect : public Module
 {
  public:
-       void init()
-       {
-               ServerInstance->Modules->Attach(I_OnUserConnect, this);
-       }
-
-       void Prioritize()
+       void Prioritize() CXX11_OVERRIDE
        {
                // for things like +x on connect, important, otherwise we have to resort to config order (bleh) -- w00t
                ServerInstance->Modules->SetPriority(this, I_OnUserConnect, PRIORITY_FIRST);
        }
 
-       virtual ~ModuleModesOnConnect()
-       {
-       }
-
-       virtual Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Sets (and unsets) modes on users when they connect", VF_VENDOR);
        }
 
-       virtual void OnUserConnect(LocalUser* user)
+       void OnUserConnect(LocalUser* user) CXX11_OVERRIDE
        {
                // Backup and zero out the disabled usermodes, so that we can override them here.
                char save[64];
@@ -62,26 +51,14 @@ class ModuleModesOnConnect : public Module
                        std::string buf;
                        std::stringstream ss(ThisModes);
 
-                       std::vector<std::string> tokens;
-
-                       // split ThisUserModes into modes and mode params
-                       while (ss >> buf)
-                               tokens.push_back(buf);
-
                        std::vector<std::string> modes;
                        modes.push_back(user->nick);
-                       modes.push_back(tokens[0]);
 
-                       if (tokens.size() > 1)
-                       {
-                               // process mode params
-                               for (unsigned int k = 1; k < tokens.size(); k++)
-                               {
-                                       modes.push_back(tokens[k]);
-                               }
-                       }
+                       // split ThisUserModes into modes and mode params
+                       while (ss >> buf)
+                               modes.push_back(buf);
 
-                       ServerInstance->Parser->CallHandler("MODE", modes, user);
+                       ServerInstance->Parser.CallHandler("MODE", modes, user);
                }
 
                memcpy(ServerInstance->Config->DisabledUModes, save, 64);