]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sslmodes.cpp
Merge pull request #514 from SaberUK/master+virtual-cleanup
[user/henk/code/inspircd.git] / src / modules / m_sslmodes.cpp
index 66a67f05a747b9de63342e6313d297b7430cdab2..360f63bc9cf8cb6b489bdf407bf864febc4db145 100644 (file)
@@ -22,7 +22,7 @@
 
 
 #include "inspircd.h"
-#include "ssl.h"
+#include "modules/ssl.h"
 
 /* $ModDesc: Provides channel mode +z to allow for Secure/SSL only channels */
 
@@ -85,15 +85,14 @@ class ModuleSSLModes : public Module
        {
        }
 
-       void init()
+       void init() CXX11_OVERRIDE
        {
-               if (!ServerInstance->Modes->AddMode(&sslm))
-                       throw ModuleException("Could not add new modes!");
+               ServerInstance->Modules->AddService(sslm);
                Implementation eventlist[] = { I_OnUserPreJoin, I_OnCheckBan, I_On005Numeric };
                ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
-       ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+       ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
        {
                if(chan && chan->IsModeSet('z'))
                {
@@ -107,7 +106,7 @@ class ModuleSSLModes : public Module
                        else
                        {
                                // Deny
-                               user->WriteServ( "489 %s %s :Cannot join channel; SSL users only (+z)", user->nick.c_str(), cname);
+                               user->WriteServ( "489 %s %s :Cannot join channel; SSL users only (+z)", user->nick.c_str(), cname.c_str());
                                return MOD_RES_DENY;
                        }
                }
@@ -115,7 +114,7 @@ class ModuleSSLModes : public Module
                return MOD_RES_PASSTHRU;
        }
 
-       ModResult OnCheckBan(User *user, Channel *c, const std::string& mask)
+       ModResult OnCheckBan(User *user, Channel *c, const std::string& mask) CXX11_OVERRIDE
        {
                if ((mask.length() > 2) && (mask[0] == 'z') && (mask[1] == ':'))
                {
@@ -127,21 +126,15 @@ class ModuleSSLModes : public Module
                return MOD_RES_PASSTHRU;
        }
 
-       ~ModuleSSLModes()
+       void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
        {
+               tokens["EXTBAN"].push_back('z');
        }
 
-       void On005Numeric(std::string &output)
-       {
-               ServerInstance->AddExtBanChar('z');
-       }
-
-       Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Provides channel mode +z to allow for Secure/SSL only channels", VF_VENDOR);
        }
 };
 
-
 MODULE_INIT(ModuleSSLModes)
-