]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_silence.cpp
Remove more text<->binary IP conversions, making code more IPv4/IPv6 independent
[user/henk/code/inspircd.git] / src / modules / m_silence.cpp
index 310f2d95aa2f16e48bee1d40e491783dd1a54f77..9b5f393e57b838cf99a32b1a8c41c9145b9f5fd3 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -12,7 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "wildcard.h"
 
 /* $ModDesc: Provides support for the /SILENCE command */
 
@@ -72,16 +71,16 @@ class CommandSVSSilence : public Command
                 */
                if (!ServerInstance->ULine(user->server))
                        return CMD_FAILURE;
-                       
+
                User *u = ServerInstance->FindNick(parameters[0]);
                if (!u)
                        return CMD_FAILURE;
-                       
+
                if (IS_LOCAL(u))
                {
                        ServerInstance->Parser->CallHandler("SILENCE", std::vector<std::string>(++parameters.begin(), parameters.end()), u);
                }
-               
+
                return CMD_SUCCESS;
        }
 };
@@ -92,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);
        }
@@ -129,13 +128,13 @@ class CommandSilence : public Command
                        if (parameters.size() > 1) {
                                pattern = CompilePattern(parameters[1].c_str());
                        }
-                       
+
                        if (!mask.length())
                        {
                                // 'SILENCE +' or 'SILENCE -', assume *!*@*
                                mask = "*!*@*";
                        }
-                       
+
                        ModeParser::CleanMask(mask);
 
                        if (action == '-')
@@ -219,7 +218,7 @@ class CommandSilence : public Command
                                case 'c':
                                        p |= SILENCE_CHANNEL;
                                        break;
-                               case 'i': 
+                               case 'i':
                                        p |= SILENCE_INVITE;
                                        break;
                                case 'n':
@@ -271,11 +270,11 @@ class ModuleSilence : public Module
        CommandSVSSilence *cmdsvssilence;
        unsigned int maxsilence;
  public:
+
        ModuleSilence(InspIRCd* Me)
                : Module(Me), maxsilence(32)
        {
-               OnRehash(NULL, "");
+               OnRehash(NULL);
                cmdsilence = new CommandSilence(ServerInstance,maxsilence);
                cmdsvssilence = new CommandSVSSilence(ServerInstance);
                ServerInstance->AddCommand(cmdsilence);
@@ -285,7 +284,7 @@ class ModuleSilence : public Module
                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);
@@ -346,10 +345,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);
                }
@@ -391,7 +387,7 @@ class ModuleSilence : public Module
                {
                        for (silencelist::const_iterator c = sl->begin(); c != sl->end(); c++)
                        {
-                               if (((((c->second & pattern) > 0)) || ((c->second & SILENCE_ALL) > 0)) && (ServerInstance->MatchText(source->GetFullHost(), c->first)))
+                               if (((((c->second & pattern) > 0)) || ((c->second & SILENCE_ALL) > 0)) && (InspIRCd::Match(source->GetFullHost(), c->first)))
                                        return !(((c->second & SILENCE_EXCLUDE) > 0));
                        }
                }
@@ -401,10 +397,10 @@ class ModuleSilence : public Module
        virtual ~ModuleSilence()
        {
        }
-       
+
        virtual Version GetVersion()
        {
-               return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
        }
 };