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) : 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 Srv->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");
52 ServerInstance->ModeGrok->InsertMode(output, "e", 1);
55 virtual int OnCheckBan(userrec* user, chanrec* chan)
60 chan->GetExt(be->GetInfoKey(), list);
64 for (modelist::iterator it = list->begin(); it != list->end(); it++)
65 if(Srv->MatchText(user->GetFullRealHost(), it->mask) || Srv->MatchText(user->GetFullHost(), it->mask))
66 // They match an entry on the list, so let them in.
70 // or if there wasn't a list, there can't be anyone on it, so we don't need to do anything.
75 virtual void OnCleanup(int target_type, void* item)
77 be->DoCleanup(target_type, item);
80 virtual void OnSyncChannel(chanrec* chan, Module* proto, void* opaque)
82 be->DoSyncChannel(chan, proto, opaque);
85 virtual void OnChannelDelete(chanrec* chan)
87 be->DoChannelDelete(chan);
90 virtual void OnRehash(const std::string ¶m)
95 virtual Version GetVersion()
97 return Version(1, 0, 0, 3, VF_STATIC | VF_VENDOR);
100 virtual ~ModuleBanException()
106 class ModuleBanExceptionFactory : public ModuleFactory
109 ModuleBanExceptionFactory()
113 ~ModuleBanExceptionFactory()
117 virtual Module* CreateModule(InspIRCd* Me)
119 return new ModuleBanException(Me);
124 extern "C" void * init_module( void )
126 return new ModuleBanExceptionFactory;