]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_regonlycreate.cpp
m_spanningtree Remove unneeded #includes
[user/henk/code/inspircd.git] / src / modules / m_regonlycreate.cpp
index 2476f520b883182033e5fba644cce177efbf04f6..98250d2a732f543f4e90f9a4910d9f4abf7445a5 100644 (file)
@@ -21,7 +21,7 @@
 
 
 #include "inspircd.h"
-#include "account.h"
+#include "modules/account.h"
 
 /* $ModDesc: Prevents users whose nicks are not registered from creating new channels */
 
@@ -31,15 +31,15 @@ class ModuleRegOnlyCreate : public Module
        void init()
        {
                Implementation eventlist[] = { I_OnUserPreJoin };
-               ServerInstance->Modules->Attach(eventlist, this, 1);
+               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(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
        {
                if (chan)
                        return MOD_RES_PASSTHRU;
 
-               if (IS_OPER(user))
+               if (user->IsOper())
                        return MOD_RES_PASSTHRU;
 
                if (user->IsModeSet('r'))
@@ -50,14 +50,10 @@ class ModuleRegOnlyCreate : public Module
                        return MOD_RES_PASSTHRU;
 
                // XXX. there may be a better numeric for this..
-               user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must have a registered nickname to create a new channel", user->nick.c_str(), cname);
+               user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must have a registered nickname to create a new channel", user->nick.c_str(), cname.c_str());
                return MOD_RES_DENY;
        }
 
-       ~ModuleRegOnlyCreate()
-       {
-       }
-
        Version GetVersion()
        {
                return Version("Prevents users whose nicks are not registered from creating new channels", VF_VENDOR);