]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_deaf.cpp
Merge pull request #1157 from SaberUK/insp20+fix-cron-restart
[user/henk/code/inspircd.git] / src / modules / m_deaf.cpp
index f52702bca8592bcc7f55c6ad9320ab4276356775..43b24cfae9c6dba39b0f6ce6b0a64c40164c792b 100644 (file)
@@ -1,19 +1,27 @@
-/*       +------------------------------------+
- *       | 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) 2006, 2008 Craig Edwards <craigedwards@brainbox.cc>
+ *   Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2006-2007 Dennis Friis <peavey@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: Provides support for ircu style usermode +d (deaf to channel messages and channel notices) */
+/* $ModDesc: Provides usermode +d to block channel messages and channel notices */
 
 /** User mode +d - filter out channel messages and channel notices
  */
@@ -56,22 +64,22 @@ class ModuleDeaf : public Module
        ModuleDeaf()
                : m1(this)
        {
-               if (!ServerInstance->Modes->AddMode(&m1))
-                       throw ModuleException("Could not add new modes!");
+       }
+
+       void init()
+       {
+               ServerInstance->Modules->AddService(m1);
 
                OnRehash(NULL);
                Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, this, 3);
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
-
        virtual void OnRehash(User* user)
        {
-               ConfigReader* conf = new ConfigReader;
-               deaf_bypasschars = conf->ReadValue("deaf", "bypasschars", 0);
-               deaf_bypasschars_uline = conf->ReadValue("deaf", "bypasscharsuline", 0);
-
-               delete conf;
+               ConfigTag* tag = ServerInstance->Config->ConfValue("deaf");
+               deaf_bypasschars = tag->getString("bypasschars");
+               deaf_bypasschars_uline = tag->getString("bypasscharsuline");
        }
 
        virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
@@ -157,7 +165,7 @@ class ModuleDeaf : public Module
 
        virtual Version GetVersion()
        {
-               return Version("Provides support for ircu style usermode +d (deaf to channel messages and channel notices)", VF_COMMON|VF_VENDOR);
+               return Version("Provides usermode +d to block channel messages and channel notices", VF_VENDOR);
        }
 
 };