X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_kicknorejoin.cpp;h=01d3aee71843939ee104c26ba025df10419a62ff;hb=a85bc774f9c4acbb2dbc1d9ddd02a460c5555391;hp=c754aa0f09e967c6c4eff50a81d95190b4d004b3;hpb=1dfead3b2cc9e8c603f6ad6f7216576a2ce361fb;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index c754aa0f0..01d3aee71 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -33,8 +33,8 @@ typedef std::map delaylist; */ class KickRejoin : public ModeHandler { + static const unsigned int max = 60; public: - unsigned int max; SimpleExtItem 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) { @@ -124,14 +113,14 @@ public: } } - if (!dl->size()) + if (dl->empty()) kr.ext.unset(chan); } } 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)