]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nickflood.cpp
Replace [cC]olour with [cC]olor
[user/henk/code/inspircd.git] / src / modules / m_nickflood.cpp
index 26d04835ae62ff4f0e6b7bdd4142350653a6334f..708d30e6beee622155de397b8c964a2f2f6def2b 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -17,7 +17,7 @@
 
 /** Holds settings and state associated with channel mode +F
  */
-class nickfloodsettings : public classbase
+class nickfloodsettings
 {
  public:
        int secs;
@@ -92,15 +92,6 @@ class NickFlood : public ModeHandler
        NickFlood(Module* Creator) : ModeHandler(Creator, "nickflood", 'F', PARAM_SETONLY, MODETYPE_CHANNEL),
                ext("nickflood", Creator) { }
 
-       ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string &parameter)
-       {
-               nickfloodsettings* x = ext.get(channel);
-               if (x)
-                       return std::make_pair(true, ConvToStr(x->nicks)+":"+ConvToStr(x->secs));
-               else
-                       return std::make_pair(false, parameter);
-       }
-
        ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
        {
                nickfloodsettings *f = ext.get(channel);
@@ -200,14 +191,14 @@ class ModuleNickFlood : public Module
        {
                if (!ServerInstance->Modes->AddMode(&nf))
                        throw ModuleException("Could not add new modes!");
-               Extensible::Register(&nf.ext);
+               ServerInstance->Extensions.Register(&nf.ext);
                Implementation eventlist[] = { I_OnUserPreNick, I_OnUserPostNick };
                ServerInstance->Modules->Attach(eventlist, this, 2);
        }
 
        ModResult OnUserPreNick(User* user, const std::string &newnick)
        {
-               if (isdigit(newnick[0])) /* allow switches to UID */
+               if (ServerInstance->NICKForced.get(user)) /* Allow forced nick changes */
                        return MOD_RES_PASSTHRU;
 
                for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++)
@@ -218,7 +209,7 @@ class ModuleNickFlood : public Module
                        nickfloodsettings *f = nf.ext.get(channel);
                        if (f)
                        {
-                               FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (channel->GetUser(user),channel,"nickflood"));
+                               res = ServerInstance->OnCheckExemption(user,channel,"nickflood");
                                if (res == MOD_RES_ALLOW)
                                        continue;
 
@@ -257,7 +248,7 @@ class ModuleNickFlood : public Module
                        nickfloodsettings *f = nf.ext.get(channel);
                        if (f)
                        {
-                               FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (channel->GetUser(user),channel,"nickflood"));
+                               res = ServerInstance->OnCheckExemption(user,channel,"nickflood");
                                if (res == MOD_RES_ALLOW)
                                        return;
                                
@@ -277,7 +268,7 @@ class ModuleNickFlood : public Module
 
        Version GetVersion()
        {
-               return Version("Channel mode F - nick flood protection", VF_COMMON | VF_VENDOR);
+               return Version("Channel mode F - nick flood protection", VF_VENDOR);
        }
 };