1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 #include "u_listmode.h"
17 /* $ModDesc: Provides support for the +I channel mode */
18 /* $ModDep: ../../include/u_listmode.h */
21 * Written by Om <om@inspircd.org>, April 2005.
22 * Based on m_exception, which was originally based on m_chanprotect and m_silence
24 * The +I channel mode takes a nick!ident@host, glob patterns allowed,
25 * and if a user matches an entry on the +I list then they can join the channel,
26 * ignoring if +i is set on the channel
27 * Now supports CIDR and IP addresses -- Brain
30 /** Handles channel mode +I
32 class InviteException : public ListModeBase
35 InviteException(Module* Creator) : ListModeBase(Creator, "invex", 'I', "End of Channel Invite Exception List", 346, 347, true) { }
38 class ModuleInviteException : public Module
42 ModuleInviteException() : ie(this)
44 if (!ServerInstance->Modes->AddMode(&ie))
45 throw ModuleException("Could not add new modes!");
47 ie.DoImplements(this);
48 Implementation eventlist[] = { I_On005Numeric, I_OnCheckInvite, I_OnCheckKey };
49 ServerInstance->Modules->Attach(eventlist, this, 3);
52 void On005Numeric(std::string &output)
54 output.append(" INVEX=I");
57 ModResult OnCheckInvite(User* user, Channel* chan)
61 modelist* list = ie.extItem.get(chan);
64 for (modelist::iterator it = list->begin(); it != list->end(); it++)
66 if (chan->CheckBan(user, it->mask))
74 return MOD_RES_PASSTHRU;
77 ModResult OnCheckKey(User* user, Channel* chan, const std::string& key)
79 if (ServerInstance->Config->ConfValue("inviteexception")->getBool("bypasskey", true))
80 return OnCheckInvite(user, chan);
81 return MOD_RES_PASSTHRU;
84 void OnCleanup(int target_type, void* item)
86 ie.DoCleanup(target_type, item);
89 void OnSyncChannel(Channel* chan, Module* proto, void* opaque)
91 ie.DoSyncChannel(chan, proto, opaque);
94 void OnRehash(User* user)
101 return Version("Provides support for the +I channel mode", VF_VENDOR);
105 MODULE_INIT(ModuleInviteException)