X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_delayjoin.cpp;h=41038d9cbc68879b8f11a411ce8558287524d141;hb=de25d946733f774e3a5b53a58438a9c92af0acbe;hp=ffaf1223b0c5d9df7afb81cb0a492967125a1963;hpb=1524caf2f799cff54c2de330c9670a0b761ba3d8;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index ffaf1223b..41038d9cb 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -19,7 +19,7 @@ class DelayJoinMode : public ModeHandler private: CUList empty; public: - DelayJoinMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Parent, 'D', PARAM_NONE, MODETYPE_CHANNEL) + DelayJoinMode(Module* Parent) : ModeHandler(Parent, 'D', PARAM_NONE, MODETYPE_CHANNEL) { levelrequired = OP_VALUE; } @@ -32,7 +32,7 @@ class ModuleDelayJoin : public Module DelayJoinMode djm; public: LocalIntExt unjoined; - ModuleDelayJoin(InspIRCd* Me) : Module(Me), djm(Me, this), unjoined("delayjoin", this) + ModuleDelayJoin() : djm(this), unjoined("delayjoin", this) { if (!ServerInstance->Modes->AddMode(&djm)) throw ModuleException("Could not add new modes!"); @@ -80,7 +80,7 @@ ModuleDelayJoin::~ModuleDelayJoin() Version ModuleDelayJoin::GetVersion() { - return Version("$Id$", VF_COMMON | VF_VENDOR); + return Version("Allows for delay-join channels (+D) where users dont appear to join until they speak", VF_COMMON | VF_VENDOR); } void ModuleDelayJoin::OnNamesListItem(User* issuer, Membership* memb, std::string &prefixes, std::string &nick) @@ -128,8 +128,17 @@ void ModuleDelayJoin::OnUserKick(User* source, Membership* memb, const std::stri ModResult ModuleDelayJoin::OnHostCycle(User* user) { - // TODO - return MOD_RES_DENY; + for (UCListIter f = user->chans.begin(); f != user->chans.end(); f++) + { + Channel* chan = *f; + Membership* memb = chan->GetUser(user); + + if (memb && unjoined.get(memb)) + { + return MOD_RES_DENY; + } + } + return MOD_RES_PASSTHRU; } void ModuleDelayJoin::OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) @@ -169,7 +178,7 @@ void ModuleDelayJoin::OnText(User* user, void* dest, int target_type, const std: /* Display the join to everyone else (the user who joined got it earlier) */ channel->WriteAllExceptSender(user, false, 0, "JOIN %s", channel->name.c_str()); - std::string n = this->ServerInstance->Modes->ModeString(user, channel); + std::string n = ServerInstance->Modes->ModeString(user, channel); if (n.length() > 0) channel->WriteAllExceptSender(user, false, 0, "MODE %s +%s", channel->name.c_str(), n.c_str()); }