]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_kicknorejoin.cpp
Always set the topic in Channel::SetTopic(), move access checks into cmd_topic
[user/henk/code/inspircd.git] / src / modules / m_kicknorejoin.cpp
index a914f38693108b69d37a357d7131a92d72c6d43c..01d3aee71843939ee104c26ba025df10419a62ff 100644 (file)
@@ -33,8 +33,8 @@ typedef std::map<std::string, time_t> delaylist;
  */
 class KickRejoin : public ModeHandler
 {
+       static const unsigned int max = 60;
  public:
-       unsigned int max;
        SimpleExtItem<delaylist> ext;
        KickRejoin(Module* Creator)
                : ModeHandler(Creator, "kicknorejoin", 'J', PARAM_SETONLY, MODETYPE_CHANNEL)
@@ -42,7 +42,7 @@ class KickRejoin : public ModeHandler
        {
        }
 
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding)
+       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE
        {
                if (adding)
                {
@@ -56,7 +56,6 @@ class KickRejoin : public ModeHandler
                                v = max;
 
                        parameter = ConvToStr(v);
-                       channel->SetModeParam(this, parameter);
                }
                else
                {
@@ -64,7 +63,6 @@ class KickRejoin : public ModeHandler
                                return MODEACTION_DENY;
 
                        ext.unset(channel);
-                       channel->SetModeParam(this, "");
                }
                return MODEACTION_ALLOW;
        }
@@ -75,29 +73,20 @@ class ModuleKickNoRejoin : public Module
        KickRejoin kr;
 
 public:
-
        ModuleKickNoRejoin()
                : kr(this)
        {
        }
 
-       void init()
+       void init() CXX11_OVERRIDE
        {
                ServerInstance->Modules->AddService(kr);
                ServerInstance->Modules->AddService(kr.ext);
-               Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserKick, I_OnRehash };
+               Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserKick };
                ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
-               OnRehash(NULL);
-       }
-
-       void OnRehash(User* user)
-       {
-               kr.max = ServerInstance->Duration(ServerInstance->Config->ConfValue("kicknorejoin")->getString("maxtime"));
-               if (!kr.max)
-                       kr.max = 30*60;
        }
 
-       ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+       ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
        {
                if (chan)
                {
@@ -131,7 +120,7 @@ public:
                return MOD_RES_PASSTHRU;
        }
 
-       void OnUserKick(User* source, Membership* memb, const std::string &reason, CUList& excepts)
+       void OnUserKick(User* source, Membership* memb, const std::string &reason, CUList& excepts) CXX11_OVERRIDE
        {
                if (memb->chan->IsModeSet(&kr) && (IS_LOCAL(memb->user)) && (source != memb->user))
                {
@@ -145,15 +134,10 @@ public:
                }
        }
 
-       ~ModuleKickNoRejoin()
-       {
-       }
-
-       Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Channel mode to delay rejoin after kick", VF_VENDOR);
        }
 };
 
-
 MODULE_INIT(ModuleKickNoRejoin)