X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcoremods%2Fcore_channel%2Fcore_channel.cpp;h=aba4d97690ddb28d6270cc05357850b68e4300b3;hb=a124a3783d8e8136b63f188bbd292c391811df54;hp=ec617af134d9a1676110e6412bb6851811ea75b5;hpb=a95853c96493bbf8609febfc4395a21ff0b711d5;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_channel/core_channel.cpp b/src/coremods/core_channel/core_channel.cpp index ec617af13..aba4d9769 100644 --- a/src/coremods/core_channel/core_channel.cpp +++ b/src/coremods/core_channel/core_channel.cpp @@ -19,9 +19,11 @@ #include "inspircd.h" #include "core_channel.h" +#include "invite.h" class CoreModChannel : public Module { + Invite::APIImpl invapi; CommandInvite cmdinvite; CommandJoin cmdjoin; CommandKick cmdkick; @@ -31,21 +33,23 @@ class CoreModChannel : public Module ModResult IsInvited(User* user, Channel* chan) { LocalUser* localuser = IS_LOCAL(user); - if ((localuser) && (localuser->IsInvited(chan))) + if ((localuser) && (invapi.IsInvited(localuser, chan))) return MOD_RES_ALLOW; return MOD_RES_PASSTHRU; } public: CoreModChannel() - : cmdinvite(this), cmdjoin(this), cmdkick(this), cmdnames(this), cmdtopic(this) + : invapi(this) + , cmdinvite(this, invapi), cmdjoin(this), cmdkick(this), cmdnames(this), cmdtopic(this) { } void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { + ConfigTag* optionstag = ServerInstance->Config->ConfValue("options"); Implementation events[] = { I_OnCheckKey, I_OnCheckLimit, I_OnCheckChannelBan }; - if (ServerInstance->Config->InvBypassModes) + if (optionstag->getBool("invitebypassmodes", true)) ServerInstance->Modules.Attach(events, this, sizeof(events)/sizeof(Implementation)); else { @@ -61,7 +65,7 @@ class CoreModChannel : public Module if (localuser) { // Remove existing invite, if any - localuser->RemoveInvite(chan); + invapi.Remove(localuser, chan); if (chan->topicset) Topic::ShowTopic(localuser, chan); @@ -95,6 +99,17 @@ class CoreModChannel : public Module return IsInvited(user, chan); } + void OnUserDisconnect(LocalUser* user) CXX11_OVERRIDE + { + invapi.RemoveAll(user); + } + + void OnChannelDelete(Channel* chan) CXX11_OVERRIDE + { + // Make sure the channel won't appear in invite lists from now on, don't wait for cull to unset the ext + invapi.RemoveAll(chan); + } + void Prioritize() CXX11_OVERRIDE { ServerInstance->Modules.SetPriority(this, I_OnPostJoin, PRIORITY_FIRST);