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
23 class BanException : public ListModeBase
26 BanException(InspIRCd* Instance) : ListModeBase(Instance, 'e', "End of Channel Exception List", "348", "349", true) { }
30 class ModuleBanException : public Module
36 ModuleBanException(InspIRCd* Me)
39 be = new BanException(ServerInstance);
40 ServerInstance->AddMode(be, 'e');
43 virtual void Implements(char* List)
45 be->DoImplements(List);
46 List[I_On005Numeric] = List[I_OnCheckBan] = 1;
49 virtual void On005Numeric(std::string &output)
51 output.append(" EXCEPTS=e");
54 virtual int OnCheckBan(userrec* user, chanrec* chan)
59 chan->GetExt(be->GetInfoKey(), list);
63 for (modelist::iterator it = list->begin(); it != list->end(); it++)
64 if(ServerInstance->MatchText(user->GetFullRealHost(), it->mask) || ServerInstance->MatchText(user->GetFullHost(), it->mask))
65 // They match an entry on the list, so let them in.
69 // or if there wasn't a list, there can't be anyone on it, so we don't need to do anything.
74 virtual void OnCleanup(int target_type, void* item)
76 be->DoCleanup(target_type, item);
79 virtual void OnSyncChannel(chanrec* chan, Module* proto, void* opaque)
81 be->DoSyncChannel(chan, proto, opaque);
84 virtual void OnChannelDelete(chanrec* chan)
86 be->DoChannelDelete(chan);
89 virtual void OnRehash(const std::string ¶m)
94 virtual Version GetVersion()
96 return Version(1, 0, 0, 3, VF_STATIC | VF_VENDOR);
99 virtual ~ModuleBanException()
105 class ModuleBanExceptionFactory : public ModuleFactory
108 ModuleBanExceptionFactory()
112 ~ModuleBanExceptionFactory()
116 virtual Module* CreateModule(InspIRCd* Me)
118 return new ModuleBanException(Me);
123 extern "C" void * init_module( void )
125 return new ModuleBanExceptionFactory;