2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
5 * Copyright (C) 2006-2008 Craig Edwards <craigedwards@brainbox.cc>
6 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
7 * Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
8 * Copyright (C) 2006 Oliver Lupton <oliverlupton@gmail.com>
10 * This file is part of InspIRCd. InspIRCd is free software: you can
11 * redistribute it and/or modify it under the terms of the GNU General Public
12 * License as published by the Free Software Foundation, version 2.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 * Written by Om <om@inspircd.org>, April 2005.
29 * Based on m_exception, which was originally based on m_chanprotect and m_silence
31 * The +I channel mode takes a nick!ident@host, glob patterns allowed,
32 * and if a user matches an entry on the +I list then they can join the channel,
33 * ignoring if +i is set on the channel
34 * Now supports CIDR and IP addresses -- Brain
37 /** Handles channel mode +I
39 class InviteException : public ListModeBase
42 InviteException(Module* Creator) : ListModeBase(Creator, "invex", 'I', "End of Channel Invite Exception List", 346, 347, true) { }
45 class ModuleInviteException : public Module
47 bool invite_bypass_key;
50 ModuleInviteException() : ie(this)
54 void init() CXX11_OVERRIDE
56 ServerInstance->Modules->AddService(ie);
59 ie.DoImplements(this);
62 void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
64 tokens["INVEX"] = "I";
67 ModResult OnCheckInvite(User* user, Channel* chan) CXX11_OVERRIDE
69 ListModeBase::ModeList* list = ie.GetList(chan);
72 for (ListModeBase::ModeList::iterator it = list->begin(); it != list->end(); it++)
74 if (chan->CheckBan(user, it->mask))
81 return MOD_RES_PASSTHRU;
84 ModResult OnCheckKey(User* user, Channel* chan, const std::string& key) CXX11_OVERRIDE
86 if (invite_bypass_key)
87 return OnCheckInvite(user, chan);
88 return MOD_RES_PASSTHRU;
91 void OnSyncChannel(Channel* chan, Module* proto, void* opaque) CXX11_OVERRIDE
93 ie.DoSyncChannel(chan, proto, opaque);
96 void OnRehash(User* user) CXX11_OVERRIDE
98 invite_bypass_key = ServerInstance->Config->ConfValue("inviteexception")->getBool("bypasskey", true);
102 Version GetVersion() CXX11_OVERRIDE
104 return Version("Provides support for the +I channel mode", VF_VENDOR);
108 MODULE_INIT(ModuleInviteException)