8 #include "helperfuncs.h"
10 #include "u_listmode.h"
12 /* $ModDesc: Provides support for the +e channel mode */
14 /* Written by Om<om@inspircd.org>, April 2005. */
15 /* Rewritten to use the listmode utility by Om, December 2005 */
16 /* Adapted from m_exception, which was originally based on m_chanprotect and m_silence */
18 // The +e channel mode takes a nick!ident@host, glob patterns allowed,
19 // and if a user matches an entry on the +e list then they can join the channel, overriding any (+b) bans set on them
21 extern InspIRCd* ServerInstance;
23 class BanException : public ListModeBase
26 BanException(InspIRCd* Instance, Server* serv) : ListModeBase(Instance, serv, 'e', "End of Channel Exception List", "348", "349", true) { }
30 class ModuleBanException : public Module
36 ModuleBanException(Server* serv)
37 : Module::Module(serv)
39 be = new BanException(ServerInstance, serv);
41 Srv->AddMode(be, 'e');
44 virtual void Implements(char* List)
46 be->DoImplements(List);
47 List[I_On005Numeric] = List[I_OnCheckBan] = 1;
50 virtual void On005Numeric(std::string &output)
52 output.append(" EXCEPTS=e");
53 ServerInstance->ModeGrok->InsertMode(output, "e", 1);
56 virtual int OnCheckBan(userrec* user, chanrec* chan)
61 chan->GetExt(be->GetInfoKey(), list);
65 for (modelist::iterator it = list->begin(); it != list->end(); it++)
66 if(Srv->MatchText(user->GetFullRealHost(), it->mask) || Srv->MatchText(user->GetFullHost(), it->mask))
67 // They match an entry on the list, so let them in.
71 // or if there wasn't a list, there can't be anyone on it, so we don't need to do anything.
76 virtual void OnCleanup(int target_type, void* item)
78 be->DoCleanup(target_type, item);
81 virtual void OnSyncChannel(chanrec* chan, Module* proto, void* opaque)
83 be->DoSyncChannel(chan, proto, opaque);
86 virtual void OnChannelDelete(chanrec* chan)
88 be->DoChannelDelete(chan);
91 virtual void OnRehash(const std::string ¶m)
96 virtual Version GetVersion()
98 return Version(1, 0, 0, 3, VF_STATIC | VF_VENDOR);
101 virtual ~ModuleBanException()
107 class ModuleBanExceptionFactory : public ModuleFactory
110 ModuleBanExceptionFactory()
114 ~ModuleBanExceptionFactory()
118 virtual Module* CreateModule(Server* serv)
120 return new ModuleBanException(serv);
126 extern "C" void * init_module( void )
128 return new ModuleBanExceptionFactory;