2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
5 * Copyright (C) 2013, 2017-2020 Sadie Powell <sadie@witchery.services>
6 * Copyright (C) 2012-2013 Attila Molnar <attilamolnar@hush.com>
7 * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
8 * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
9 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
10 * Copyright (C) 2006, 2010 Craig Edwards <brain@inspircd.org>
12 * This file is part of InspIRCd. InspIRCd is free software: you can
13 * redistribute it and/or modify it under the terms of the GNU General Public
14 * License as published by the Free Software Foundation, version 2.
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
33 RPL_ENDOFINVEXLIST = 347
36 class InviteException : public ListModeBase
39 InviteException(Module* Creator)
40 : ListModeBase(Creator, "invex", 'I', "End of Channel Invite Exception List", RPL_INVEXLIST, RPL_ENDOFINVEXLIST, true)
46 class ModuleInviteException : public Module
48 bool invite_bypass_key;
51 ModuleInviteException() : ie(this)
55 void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
57 tokens["INVEX"] = ConvToStr(ie.GetModeChar());
60 ModResult OnCheckInvite(User* user, Channel* chan) CXX11_OVERRIDE
62 ListModeBase::ModeList* list = ie.GetList(chan);
65 for (ListModeBase::ModeList::iterator it = list->begin(); it != list->end(); it++)
67 if (chan->CheckBan(user, it->mask))
74 return MOD_RES_PASSTHRU;
77 ModResult OnCheckKey(User* user, Channel* chan, const std::string& key) CXX11_OVERRIDE
79 if (invite_bypass_key)
80 return OnCheckInvite(user, chan);
81 return MOD_RES_PASSTHRU;
84 void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
87 invite_bypass_key = ServerInstance->Config->ConfValue("inviteexception")->getBool("bypasskey", true);
90 Version GetVersion() CXX11_OVERRIDE
92 return Version("Adds channel mode I (invex) which allows channel operators to exempt user masks from the i (inviteonly) channel mode.", VF_VENDOR);
96 MODULE_INIT(ModuleInviteException)