]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_channames.cpp
m_ldapoper Fix typo spotted by @lordsith49
[user/henk/code/inspircd.git] / src / modules / m_channames.cpp
index f89b6ab009bfae90748e9dc0b96f35f510e83a9e..e78171c4af53816bfc1d7c1b6a5865ac4055e89d 100644 (file)
@@ -1,16 +1,22 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
  *
- * 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"
 
 /* $ModDesc: Implements config tags which allow changing characters allowed in channel names */
@@ -49,12 +55,15 @@ class ModuleChannelNames : public Module
        bool badchan;
 
  public:
-       ModuleChannelNames() : rememberer(ServerInstance->IsChannel)
+       ModuleChannelNames() : rememberer(ServerInstance->IsChannel), badchan(false)
+       {
+       }
+
+       void init()
        {
                ServerInstance->IsChannel = &myhandler;
-               badchan = false;
                Implementation eventlist[] = { I_OnRehash, I_OnUserKick };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
                OnRehash(NULL);
        }
 
@@ -89,9 +98,9 @@ class ModuleChannelNames : public Module
 
        virtual void OnRehash(User* user)
        {
-               ConfigReader Conf;
-               std::string denyToken = Conf.ReadValue("channames", "denyrange", 0);
-               std::string allowToken = Conf.ReadValue("channames", "allowrange", 0);
+               ConfigTag* tag = ServerInstance->Config->ConfValue("channames");
+               std::string denyToken = tag->getString("denyrange");
+               std::string allowToken = tag->getString("allowrange");
                allowedmap.set();
 
                irc::portparser denyrange(denyToken, false);