]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_cloaking.cpp
Remove NULL checks from various Channel functions
[user/henk/code/inspircd.git] / src / modules / m_cloaking.cpp
index 9eb9a8da90421541e053db2b5977f29736af35cf..ccc98e557e7ca96e99ff5b26c0c4b8c6c55ca25e 100644 (file)
@@ -148,7 +148,7 @@ class ModuleCloaking : public Module
        {
        }
 
-       void init()
+       void init() CXX11_OVERRIDE
        {
                OnRehash(NULL);
 
@@ -284,7 +284,7 @@ class ModuleCloaking : public Module
                return rv;
        }
 
-       ModResult OnCheckBan(User* user, Channel* chan, const std::string& mask)
+       ModResult OnCheckBan(User* user, Channel* chan, const std::string& mask) CXX11_OVERRIDE
        {
                LocalUser* lu = IS_LOCAL(user);
                if (!lu)
@@ -295,9 +295,8 @@ class ModuleCloaking : public Module
                /* Check if they have a cloaked host, but are not using it */
                if (cloak && *cloak != user->dhost)
                {
-                       char cmask[MAXBUF];
-                       snprintf(cmask, MAXBUF, "%s!%s@%s", user->nick.c_str(), user->ident.c_str(), cloak->c_str());
-                       if (InspIRCd::Match(cmask,mask))
+                       const std::string cloakMask = user->nick + "!" + user->ident + "@" + *cloak;
+                       if (InspIRCd::Match(cloakMask, mask))
                                return MOD_RES_DENY;
                }
                return MOD_RES_PASSTHRU;
@@ -311,7 +310,7 @@ class ModuleCloaking : public Module
 
        // this unsets umode +x on every host change. If we are actually doing a +x
        // mode change, we will call SetMode back to true AFTER the host change is done.
-       void OnChangeHost(User* u, const std::string& host)
+       void OnChangeHost(User* u, const std::string& host) CXX11_OVERRIDE
        {
                if(u->IsModeSet('x'))
                {
@@ -320,7 +319,7 @@ class ModuleCloaking : public Module
                }
        }
 
-       Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                std::string testcloak = "broken";
                if (Hash)
@@ -337,7 +336,7 @@ class ModuleCloaking : public Module
                return Version("Provides masking of user hostnames", VF_COMMON|VF_VENDOR, testcloak);
        }
 
-       void OnRehash(User* user)
+       void OnRehash(User* user) CXX11_OVERRIDE
        {
                ConfigTag* tag = ServerInstance->Config->ConfValue("cloak");
                prefix = tag->getString("prefix");
@@ -377,7 +376,7 @@ class ModuleCloaking : public Module
                return chost;
        }
 
-       void OnUserConnect(LocalUser* dest)
+       void OnUserConnect(LocalUser* dest) CXX11_OVERRIDE
        {
                std::string* cloak = cu.ext.get(dest);
                if (cloak)
@@ -398,7 +397,7 @@ CmdResult CommandCloak::Handle(const std::vector<std::string> &parameters, User
        else
                cloak = mod->GenCloak(sa, "", parameters[0]);
 
-       user->WriteServ("NOTICE %s :*** Cloak for %s is %s", user->nick.c_str(), parameters[0].c_str(), cloak.c_str());
+       user->WriteNotice("*** Cloak for " + parameters[0] + " is " + cloak);
 
        return CMD_SUCCESS;
 }