]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_silence.cpp
Allow commands to optionally route themselves using ENCAP
[user/henk/code/inspircd.git] / src / modules / m_silence.cpp
index 488389bea44a9d1287e52cc8467063e86e33f24c..0786c4da4fa60e274b3890fed69ff14a94a190e3 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -91,7 +91,7 @@ class CommandSilence : public Command
  public:
        CommandSilence (InspIRCd* Instance, unsigned int &max) : Command(Instance,"SILENCE", 0, 0), maxsilence(max)
        {
-               this->source = "m_silence_ext.so";
+               this->source = "m_silence.so";
                syntax = "{[+|-]<mask> <p|c|i|n|t|a|x>}";
                TRANSLATE3(TR_TEXT, TR_TEXT, TR_END);
        }
@@ -266,25 +266,23 @@ class CommandSilence : public Command
 
 class ModuleSilence : public Module
 {
-       CommandSilence* cmdsilence;
-       CommandSVSSilence *cmdsvssilence;
        unsigned int maxsilence;
+       CommandSilence cmdsilence;
+       CommandSVSSilence cmdsvssilence;
  public:
 
        ModuleSilence(InspIRCd* Me)
-               : Module(Me), maxsilence(32)
+               : Module(Me), maxsilence(32), cmdsilence(Me, maxsilence), cmdsvssilence(Me)
        {
-               OnRehash(NULL, "");
-               cmdsilence = new CommandSilence(ServerInstance,maxsilence);
-               cmdsvssilence = new CommandSVSSilence(ServerInstance);
-               ServerInstance->AddCommand(cmdsilence);
-               ServerInstance->AddCommand(cmdsvssilence);
+               OnRehash(NULL);
+               ServerInstance->AddCommand(&cmdsilence);
+               ServerInstance->AddCommand(&cmdsvssilence);
 
                Implementation eventlist[] = { I_OnRehash, I_OnBuildExemptList, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnUserPreInvite };
                ServerInstance->Modules->Attach(eventlist, this, 7);
        }
 
-       virtual void OnRehash(User* user, const std::string &parameter)
+       virtual void OnRehash(User* user)
        {
                ConfigReader Conf(ServerInstance);
                maxsilence = Conf.ReadInteger("silence", "maxentries", 0, true);
@@ -345,10 +343,7 @@ class ModuleSilence : public Module
 
        virtual int PreText(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list, int silence_type)
        {
-               if (!IS_LOCAL(user))
-                       return 0;
-
-               if (target_type == TYPE_USER)
+               if (target_type == TYPE_USER && IS_LOCAL(((User*)dest)))
                {
                        return MatchPattern((User*)dest, user, silence_type);
                }