]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_timedbans.cpp
m_callerid Route ACCEPT to the server of the target user only, do not send METADATA...
[user/henk/code/inspircd.git] / src / modules / m_timedbans.cpp
index 81b12d8816a99db076f5e8c1453df79c52b0a360..a76d89c827d0efc5bf36cdad4001fb82162e8832 100644 (file)
@@ -70,7 +70,7 @@ class CommandTban : public Command
                unsigned long expire = duration + ServerInstance->Time();
                if (duration < 1)
                {
-                       user->WriteServ("NOTICE "+user->nick+" :Invalid ban time");
+                       user->WriteNotice("Invalid ban time");
                        return CMD_FAILURE;
                }
                std::string mask = parameters[2];
@@ -80,20 +80,17 @@ class CommandTban : public Command
                bool isextban = ((mask.size() > 2) && (mask[1] == ':'));
                if (!isextban && !ServerInstance->IsValidMask(mask))
                        mask.append("!*@*");
-               if ((mask.length() > 250) || (!ServerInstance->IsValidMask(mask) && !isextban))
-               {
-                       user->WriteServ("NOTICE "+user->nick+" :Invalid ban mask");
-                       return CMD_FAILURE;
-               }
+
                setban.push_back(mask);
                // use CallHandler to make it so that the user sets the mode
                // themselves
                ServerInstance->Parser->CallHandler("MODE",setban,user);
-               for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++)
-                       if (!strcasecmp(i->data.c_str(), mask.c_str()))
-                               goto found;
-               return CMD_FAILURE;
-found:
+               if (ServerInstance->Modes->GetLastParse().empty())
+               {
+                       user->WriteNotice("Invalid ban mask");
+                       return CMD_FAILURE;
+               }
+
                CUList tmp;
                T.channel = channelname;
                T.mask = mask;
@@ -118,11 +115,11 @@ class BanWatcher : public ModeWatcher
 {
  public:
        BanWatcher(Module* parent)
-               : ModeWatcher(parent, 'b', MODETYPE_CHANNEL)
+               : ModeWatcher(parent, "ban", MODETYPE_CHANNEL)
        {
        }
 
-       void AfterMode(User* source, User* dest, Channel* chan, const std::string& banmask, bool adding, ModeType type)
+       void AfterMode(User* source, User* dest, Channel* chan, const std::string& banmask, bool adding)
        {
                if (adding)
                        return;
@@ -154,7 +151,7 @@ class ModuleTimedBans : public Module
        {
        }
 
-       void init()
+       void init() CXX11_OVERRIDE
        {
                ServerInstance->Modules->AddService(cmd);
                Implementation eventlist[] = { I_OnBackgroundTimer };
@@ -167,7 +164,7 @@ class ModuleTimedBans : public Module
                ServerInstance->Modes->DelModeWatcher(&banwatcher);
        }
 
-       virtual void OnBackgroundTimer(time_t curtime)
+       void OnBackgroundTimer(time_t curtime) CXX11_OVERRIDE
        {
                timedbans expired;
                for (timedbans::iterator i = TimedBanList.begin(); i != TimedBanList.end();)
@@ -203,7 +200,7 @@ class ModuleTimedBans : public Module
                }
        }
 
-       virtual Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Adds timed bans", VF_COMMON | VF_VENDOR);
        }