]> 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 a25ba8edc9715b61382746208fb5b1398b1d0361..98250d2a732f543f4e90f9a4910d9f4abf7445a5 100644 (file)
@@ -1,36 +1,45 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2007 Craig Edwards <craigedwards@brainbox.cc>
  *
- * This program is free but copyrighted software; see
- *            the file COPYING for details.
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
  *
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+
 #include "inspircd.h"
-#include "account.h"
+#include "modules/account.h"
 
 /* $ModDesc: Prevents users whose nicks are not registered from creating new channels */
 
 class ModuleRegOnlyCreate : public Module
 {
  public:
-       ModuleRegOnlyCreate()
+       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'))
@@ -41,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);