X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_inviteexception.cpp;h=2e6f6db6533f98ea5cc7384ee73c5612f87e3448;hb=3cf993500544c2157992650da2487bfa89be405d;hp=91f4e22c8acfacc7ac84f80687c5ca9453b5f9a6;hpb=7e843c22e16c81054bad18073d24fe1a07026431;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index 91f4e22c8..2e6f6db65 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -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 @@ -32,7 +32,7 @@ class InviteException : public ListModeBase { public: - InviteException(Module* Creator) : ListModeBase(Creator, 'I', "End of Channel Invite Exception List", 346, 347, true) { } + InviteException(Module* Creator) : ListModeBase(Creator, "invex", 'I', "End of Channel Invite Exception List", 346, 347, true) { } }; class ModuleInviteException : public Module @@ -43,11 +43,10 @@ public: { if (!ServerInstance->Modes->AddMode(&ie)) throw ModuleException("Could not add new modes!"); - ServerInstance->Modules->PublishInterface("ChannelBanList", this); ie.DoImplements(this); - Implementation eventlist[] = { I_On005Numeric, I_OnCheckInvite }; - ServerInstance->Modules->Attach(eventlist, this, 2); + Implementation eventlist[] = { I_On005Numeric, I_OnCheckInvite, I_OnCheckKey }; + ServerInstance->Modules->Attach(eventlist, this, 3); } void On005Numeric(std::string &output) @@ -62,7 +61,6 @@ public: modelist* list = ie.extItem.get(chan); if (list) { - std::string mask = std::string(user->nick) + "!" + user->ident + "@" + user->GetIPString(); for (modelist::iterator it = list->begin(); it != list->end(); it++) { if (chan->CheckBan(user, it->mask)) @@ -71,12 +69,18 @@ public: } } } - // or if there wasn't a list, there can't be anyone on it, so we don't need to do anything. } return MOD_RES_PASSTHRU; } + ModResult OnCheckKey(User* user, Channel* chan, const std::string& key) + { + if (ServerInstance->Config->ConfValue("inviteexception")->getBool("bypasskey", true)) + return OnCheckInvite(user, chan); + return MOD_RES_PASSTHRU; + } + void OnCleanup(int target_type, void* item) { ie.DoCleanup(target_type, item); @@ -94,12 +98,7 @@ public: Version GetVersion() { - return Version("Provides support for the +I channel mode", VF_VENDOR | VF_COMMON, API_VERSION); - } - - ~ModuleInviteException() - { - ServerInstance->Modules->UnpublishInterface("ChannelBanList", this); + return Version("Provides support for the +I channel mode", VF_VENDOR); } };