]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_ojoin.cpp
Make various self contained methods static.
[user/henk/code/inspircd.git] / src / modules / m_ojoin.cpp
index 8f7fe4460e719d4e60fe567a0350a54375bef887..e4314873bcb073998cb14d0013dde61e5e9569ce 100644 (file)
@@ -69,7 +69,7 @@ class CommandOjoin : public SplitCommand
                        // they're already in the channel
                        std::vector<std::string> modes;
                        modes.push_back(parameters[0]);
-                       modes.push_back("+" + npmh->GetModeChar());
+                       modes.push_back(std::string("+") + npmh->GetModeChar());
                        if (op)
                        {
                                modes[1].push_back('o');
@@ -84,16 +84,14 @@ class CommandOjoin : public SplitCommand
 
 /** channel mode +Y
  */
-class NetworkPrefix : public ModeHandler
+class NetworkPrefix : public PrefixMode
 {
  public:
        NetworkPrefix(Module* parent, char NPrefix)
-               : ModeHandler(parent, "official-join", 'Y', PARAM_ALWAYS, MODETYPE_CHANNEL)
+               : PrefixMode(parent, "official-join", 'Y')
        {
-               list = true;
                prefix = NPrefix;
                levelrequired = INT_MAX;
-               m_paramtype = TR_NICK;
                prefixrank = NETWORK_VALUE;
        }
 
@@ -106,12 +104,6 @@ class NetworkPrefix : public ModeHandler
 
                return MOD_RES_PASSTHRU;
        }
-
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
-       {
-               return MODEACTION_ALLOW;
-       }
-
 };
 
 class ModuleOjoin : public Module
@@ -128,9 +120,6 @@ class ModuleOjoin : public Module
 
        void init() CXX11_OVERRIDE
        {
-               /* Load config stuff */
-               OnRehash(NULL);
-
                std::string npre = ServerInstance->Config->ConfValue("ojoin")->getString("prefix");
                char NPrefix = npre.empty() ? 0 : npre[0];
                if (NPrefix && ServerInstance->Modes->FindPrefix(NPrefix))
@@ -141,7 +130,6 @@ class ModuleOjoin : public Module
                mycommand.npmh = np;
 
                ServerInstance->Modules->AddService(*np);
-               ServerInstance->Modules->AddService(mycommand);
        }
 
        ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
@@ -157,7 +145,7 @@ class ModuleOjoin : public Module
                return MOD_RES_PASSTHRU;
        }
 
-       void OnRehash(User* user) CXX11_OVERRIDE
+       void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
                ConfigTag* Conf = ServerInstance->Config->ConfValue("ojoin");
                mycommand.notice = Conf->getBool("notice", true);
@@ -174,7 +162,7 @@ class ModuleOjoin : public Module
                if (source == memb->user)
                        return MOD_RES_PASSTHRU;
 
-               source->WriteNumeric(484, source->nick+" "+memb->chan->name+" :Can't kick "+memb->user->nick+" as they're on official network business.");
+               source->WriteNumeric(ERR_RESTRICTED, memb->chan->name+" :Can't kick "+memb->user->nick+" as they're on official network business.");
                return MOD_RES_DENY;
        }